You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
805 B
26 lines
805 B
import { computed, ref } from 'vue'
|
|
import { useStore } from '@/store'
|
|
import { Language } from '@/store/state'
|
|
|
|
type Keys = {
|
|
// eslint-disable-next-line no-unused-vars
|
|
[K in Language]: string[]
|
|
}
|
|
|
|
export const useDay = () => {
|
|
const days: Keys = {
|
|
zh: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
|
|
en: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
tw: ['星期日', '星期壹', '星期二', '星期三', '星期四', '星期五', '星期六']
|
|
}
|
|
|
|
const date = ref(new Date())
|
|
const store = useStore()
|
|
const language = computed(() => store.$state.language)
|
|
|
|
const currentWeek = () => days[language.value][date.value.getDay()]
|
|
|
|
const whichWeek = computed(currentWeek)
|
|
|
|
return { whichWeek }
|
|
}
|
|
|