You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When setting the date with Year & Week I would expect not being able to pass an invalid localWeekNumber however when I pass an invalid value. It pulls a date one week into the next year.
Not sure if this is a bug or by design but I suspect the latter.
Looking at the existing tests I can see a test for handling wrapping to the previous year, which is a valid scenario (See note 1), but ideally there should be additional boundary tests that test for week 53 in different locales (which is valid) and weeks beyond this, e.g. Week 54, Week 108, etc.
It looks like weekToGregorian in conversions.js handles this specific case where the localWeekNumber results in a day greater than 365, it just shifts the year accordingly, so my assumption it is by design.
Even if it was decided that it is a bug and the current behaviour needs reviewing then there'd also the possibility (based on responses to other PRs I've seen) that there would be reluctance to merge a PR in case people rely on the current behaviour.
Needs clarification from the repo owners.
note 1 - For clarification:
US first day of the week is Sunday
ISO Standard first day of the week is Monday
US first week of the year is the week that has 1st January in it
ISO standard first week of the year is the week that has the first Thursday in it
So if Saturday was January 1st, then:
First day of first week in US would be Sunday 26th December
First day of first week in ISO Standard would be Monday 3rd January
Describe the bug
When setting the date with Year & Week I would expect not being able to pass an invalid localWeekNumber however when I pass an invalid value. It pulls a date one week into the next year.
To Reproduce
Actual vs Expected behavior
I would expect localWeekNumber to throw an error for passing an invalid week.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: