Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to pass invalid localWeekNumber #1590

Open
mgarf opened this issue Jan 28, 2024 · 0 comments
Open

Able to pass invalid localWeekNumber #1590

mgarf opened this issue Jan 28, 2024 · 0 comments

Comments

@mgarf
Copy link

mgarf commented Jan 28, 2024

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

DateTime.local({ zone: 'utc', locale: 'en-US' }).set({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 })
// { ts: 2021-12-26T19:39:12.809Z, zone: UTC, locale: en-US }
DateTime.local({ zone: 'utc', locale: 'en-US' }).set({ localWeekYear: 2021, localWeekNumber: 53, localWeekday: 1 })
// { ts: 2021-12-26T19:39:12.810Z, zone: UTC, locale: en-US }

Actual vs Expected behavior
I would expect localWeekNumber to throw an error for passing an invalid week.

Desktop (please complete the following information):

  • OS: [e.g. iOS] : Windows
  • Browser [e.g. Chrome 84, safari 14.0] : Chrome 120.0.6099.225
  • Luxon version [e.g. 1.25.0] : 3.4.4
  • Your timezone [e.g. "America/New_York"] : America/Chicago
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant