-
Notifications
You must be signed in to change notification settings - Fork 729
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
Settings.defaultWeekSettings not working #1570
Comments
In my tests this works correctly. Are you setting |
In my opinion having to opt-in to use the default week settings (by passing Would it be possible to have the |
No, because that would be a breaking change.
Sure, I'd be fine with accepting a PR that adds this as an additional option. However this option not just applies to |
Well, I assumed it would be the case. And how about adding With that option we could write this: Settings.defaultWeekSettings = {
useLocaleWeeks: true,
firstDay: 7,
minimalDays: 4,
weekend: [6, 7],
};
DateTime.local(2024, 9, 10).startOf('week'); which would be equivalent to this: Settings.defaultWeekSettings = {
firstDay: 7,
minimalDays: 4,
weekend: [6, 7],
};
DateTime.local(2024, 9, 10).startOf('week', { useLocaleWeeks: true }); |
I personally don't like this approach and would prefer to have as little "behavior altering Settings" as possible. |
I fully support the point about avoiding settings which change the API contract, for example At the same time I find the settings which define the locale-dependent preferences extremely useful, for example In my opinion The problem I see with The minimum I'm trying to achieve is to be able to call Here's how I think we could approach it. Step 1Add Step 2
Step 3
End result
What are your thoughts about the above? How would you approach avoiding the need for |
I wouldn't. You don't always want locale-based weeks. |
Could Luxon allow developers to set a preference globally to determine, if they want locale-based or ISO-based weeks by default, without having to set it every time when calling |
That is exactly what I would like to avoid as explained in my previous comment. To me this is the same as globally configuring that If I am a library author and my library is supposed to work in conjunction with Luxon, I would no longer be able to rely on Luxon's API, because users can just configure it to operate differently. |
I see now that adding
Thank you for the great insights and quick replies. |
That is not what
A pull request for this would have my support for sure. |
Describe the bug
Settings.defaultWeekSettings has no effect at all, the weeks are starting still at Sunday
To Reproduce
Settings.defaultLocale = 'de-CH'
Settings.defaultWeekSettings = { firstDay: 1, minimalDays: 1, weekend: [6, 7] }
Actual vs Expected behavior
I want to set default start day of the week to monday, currently is nothing changed when i set the Settings.defaultWeekSettings
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: