startOf('week') is not respecting locale setting
See original GitHub issueWhile most countries in the world assume the week starts on Monday, US, Canada, and Australia consider Sunday as the first day of the week. It seems that luxon hard-coded the start of week as Monday.
// prints "2018-11-19T00:00:00.000-08:00"
console.log(DateTime.fromISO('2018-11-22T10:00', {zone: 'America/Los_Angeles'}.startOf('week').toISO());
Note that moment does actually respect the locale setting
// prints "2018-11-18T08:00:00.000Z"
console.log(moment.tz('2018-11-22T10:00', "America/Los_Angeles").startOf('week').toISOString());
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:21 (5 by maintainers)
Top Results From Across the Web
How to create momentLocaleData.firstDayOfWeek() in luxon?
I fear that, at the moment (current version 2.4.0 ), it is not possible achieve this using Luxon. The Luxon 1.x docs states:....
Read more >Calendar doesn't respect start of week setting from google ...
Set start of week in http://calendar.google.com settings to Monday. 2. I have a repeating every 3 week Monday-Sunday all day event. Monday 17th...
Read more >Day of Week (Locale Aware)
Gets or sets the day of the week according to the locale. This dependent on Weekday plugin to work. If the locale assigns...
Read more >week set to Sunday despite having Spain (Monday) as Locale
Despite having set the locale the either UK or Spain, the function is considering sunday as the start of the week and, hence,...
Read more >How to find first day of the week by locale?
Simply use the LWC I18N functionality: import firstDayOfWeek from '@salesforce/i18n/firstDayOfWeek';.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
While this is a quite old issue, I still wanted to share my quick work around:
By simply subtracting a day, you get a sunday which you can use as a start point for further actions.
edit: However, once possible, this should be part of the API.
It’s coming soon: https://chromestatus.com/feature/5566859262820352