Added base calendar formatting

This commit is contained in:
Alexis
2024-04-01 11:53:13 +02:00
parent 39c03c9706
commit c1edf3b5ea
11 changed files with 131 additions and 23 deletions

View File

@@ -0,0 +1,33 @@
<script lang="ts" setup>
import { useCalendar } from '@/stores/calendar'
import { computed } from 'vue'
const { currentConfig, currentDate, getPeriodOfYear } = useCalendar()
const navbarTitle = computed(() => {
switch (currentConfig.viewType) {
case 'month':
return `${currentDate.currentMonthName} ${currentDate.currentYear} ${currentDate.currentPeriodAbbr}`
case 'year':
return `Année ${currentDate.currentYear} ${currentDate.currentPeriodAbbr}`
case 'decade':
return `Années ${Number(currentDate.currentYear)} ${getPeriodOfYear(Number(currentDate.currentYear)).short} - ${Number(currentDate.currentYear) + 10} ${getPeriodOfYear(Number(currentDate.currentYear) + 10).short}`
case 'century':
return `Années ${Number(currentDate.currentYear)} ${getPeriodOfYear(Number(currentDate.currentYear)).short} - ${Number(currentDate.currentYear) + 100} ${getPeriodOfYear(Number(currentDate.currentYear) + 100).short}`
default:
return ''
}
})
</script>
<template>
<header>
<h1 class="text-2xl font-bold">
{{ navbarTitle }}
</h1>
</header>
</template>