-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[pickers] Use the locale week day on the Luxon adapter #19230
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5af199e
[pickers] Use the locale week day on the Luxon adapter
flaviendelangle 77f95ec
Merge branch 'master' into locale-week-day
flaviendelangle d4391b9
Fix scheduler
flaviendelangle 8744b02
Merge branch 'master' into locale-week-day
flaviendelangle 468a108
Merge branch 'master' into locale-week-day
flaviendelangle a39a5e1
Merge branch 'master' into locale-week-day
flaviendelangle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to find a better way to detect the week end 😬
I'm not even sure if some adapter have a locale-based notion of "Week end".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat trick! 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the weekend might not be on Saturday and Sunday for every locale. 🤔
Doesn't US technically have the weekend on Sunday and Monday?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that previous question part.

Regardless, based on ChatGPT information, some countries do have weekends on different days:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the week start on Sunday, but the week end is still Sartuday and Sunday AFAIK.
Those are two distinct concepts, sadly enough we don't use "week-end" to mean the end of the week 👨 🔫 . So for me the behavior of the Scheduler before this PR was already broken, probably even more than after the PR.
With that being said, I'm not surprised that not all country and culture have Saturday + Sunday as week end. Bryntum has a concept of working days (that user can define manually) which is probably what you want in a lot of scenarios (to include public holdays for example). But I'm not sure it's always what we want and I'm wondering if there is a disctinct concept of week end.
It seems that Bryntum uses there concept of "non working days" for the equivalent of the UI we built. BUT at the same time they have a class specific to week end that apply to Saturday and Sunday (they don't implement the nuance Chat GPT gave, or at least it's not documented).
TLDR: It's a mess and I think starting with the current approach and then research how to best introduce a notion of working / non-working days is fine.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about adding a
isWeekendmethod to the adapter?Looks like
Luxonanddate-fnshave the means to resolve this, whereas for others we can usegetWeekInfoas a basis and fallback to your solution ifweekInfois not available (i.e. Firefox).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be the right solution.
I think we can add it to the Base UI version and keep it hardcoded for now in the Scheduler while we use a copy paste of the MUI X adapters (I'd like to avoid having 3 versions of the adapter to maintain 😆 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the notion of work days is probably the best shot at being the silver bullet for the Scheduler's case. 👌
I agree with your proposal. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To summarize:
isWeekendmethod on the Base UI adaptersisWeekEnd).