-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[pickers] Keep the calendar header and content in sync when switching locale #14125
Conversation
…hen switching locale
2910cc1
to
8497614
Compare
@@ -1,4 +1,5 @@ | |||
import * as React from 'react'; | |||
import moment, { Moment } from 'moment'; |
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.
Not related to this PR, I just noticed that we had 2 spec files for this component
@@ -574,7 +574,7 @@ export function DayCalendar<TDate extends PickerValidDate>(inProps: DayCalendarP | |||
key={i.toString()} | |||
variant="caption" | |||
role="columnheader" | |||
aria-label={utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday')} | |||
aria-label={utils.format(weekday, 'weekday')} |
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 idea why we were re-doing the day shift here, but I spent some time finding out why my aria-label
were not updated in the test whereas the UI was good in the doc 😆
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.
Nice optimization. 👍
Deploy preview: https://deploy-preview-14125--material-ui-x.netlify.app/ |
841b7ae
to
08e4fdf
Compare
08e4fdf
to
4156d6c
Compare
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.
👏
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.
Nice fix! 👏
Sorry for a late review. 🙈
@@ -574,7 +574,7 @@ export function DayCalendar<TDate extends PickerValidDate>(inProps: DayCalendarP | |||
key={i.toString()} | |||
variant="caption" | |||
role="columnheader" | |||
aria-label={utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday')} | |||
aria-label={utils.format(weekday, 'weekday')} |
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.
Nice optimization. 👍
Fixes #12963
In
AdapterDateFns
we have the following:But on the adapters where the locale is stored on the date object, we didn't set the locale of the adapter to the value passed.
So if the locale of the value and the value of the adapter were different, it was the locale of the value that was being used.