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
828 B
26 lines
828 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 dateRef = ref(new Date())
|
|
const store = useStore()
|
|
const languageComRef = computed(() => store.language)
|
|
|
|
const currentWeek = () => days[languageComRef.value][dateRef.value.getDay()]
|
|
|
|
const whichWeekComRef = computed(currentWeek)
|
|
|
|
return { whichWeekComRef }
|
|
}
|
|
|