Add US calendar #88
Replies: 1 comment 5 replies
-
I quickly wrote the code for "Sunday as first": const getCurrentWeekDates = (date) => {
let week = []
const locale = localStorage.lang ?? 'en-US'
const weekStartOnSunday = ['en-US', 'en-CA', 'en-AU']
const startOfWeek = DateTime
.fromISO(date)
.setLocale(locale)
.startOf('week')
for (let i = 0; i <= 6; i++) {
let day = startOfWeek
.plus({
days: weekStartOnSunday.includes(locale) ? i-1 : i
})
.setLocale(locale)
week.push({
isoDate: day.toISODate(),
day: day.toFormat('d'),
weekDay: day.toFormat('EEE')
})
}
return week
}
getCurrentWeekDates('2021-09-16') This would give me the following calendar.
This code would need to be added here linked/src/store/modules/calendar/helper.js Lines 38 to 56 in 57211f0 However, this may need a new setting for people that want to choose It's not impossible, so it might be added soon in one of the next releases. Thanks for your feedback! |
Beta Was this translation helpful? Give feedback.
-
In the US they use the Sunday / M / T / W / T / F / S calendar. Auto-detect the format and select it. Would be easy to implement with grid.
Beta Was this translation helpful? Give feedback.
All reactions