-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Improvement description
Atm the calendar always starts the week on a Monday but for some countries, the week starts on a Sunday. It would be nice to have a calendar that updates the first day of the week depending on the local
Expected behavior
Something like this would work, but not yet supported on firefox
const getWeekdays = (locale: string) => {
const weekdays = []
const localeWeek = new Intl.Locale(locale)
const firstDayOfTheWeek = localeWeek.weekInfo.firstDay
for (let i = 0; i < 7; i++) {
const weekday = new Date(2021, 5, i).toLocaleString(locale, {
weekday: 'short',
})
weekdays.push(weekday)
}
if (firstDayOfTheWeek === 7) {
return weekdays
.slice(firstDayOfTheWeek - 1)
.concat(weekdays.slice(0, firstDayOfTheWeek - 1))
}
return weekdays
}
Reactions are currently unavailable