When I extract a week number from a date it seems to be starting the week from Monday, not Sunday.
I know the question on this forum is usually how to adjust the week start forward to Monday, but in this case I want it to be Sunday and I’ve no idea why I’m seeing this behavoir.
Any ideas?
For clarity, Week 42 started on 13/10/2024 for the purposes of this application.
Week 42 is from Monday, October 14, 2024 until (and including) Sunday, October 20, 2024.
But if you want your app to include Sunday from the Previous week as part of the next week you can just add 1 to the extracted Week if the day is a Sunday (although that may confuse people, as it’s actually incorrect).
But the ISO 8601 standard doesn’t care about JavaScript (or any other specific language).
In vanilla Javascript there is no built in way to establish the Week from a given Date, but libraries like Luxon.js or (the outdated/deprecated) moment.js (which is what Bubble still uses for Dates) have built in methods for getting the week of given Date, which follow the ISO standard of Weeks (at least in the context of establishing the week number) starting on Monday.