[DateTimeRangePicker] Fix date format resolving from views on 24hr locales#14341
Conversation
|
Deploy preview: https://deploy-preview-14341--material-ui-x.netlify.app/ |
0dbc59a to
dbddcbf
Compare
DateTimePickersDateTimeRangePickers
DateTimeRangePickersDateTimeRangePickers
DateTimeRangePickersDateTimeRangePickers
| if (isTimeView(view)) { | ||
| timeViews.push(view as TimeView); | ||
| } else { | ||
| } else if (isDatePickerView(view)) { |
There was a problem hiding this comment.
The problem was an oversight that we did not exclude meridiem view, which caused resolveDateFormat to always return keyboardDate in case of a locale with 12h clock.
On 24h clock the behavior was "correct".
I've adjusted the code to avoid this inconsistency and also added an exception to not resolve dateFormat on DateTimeRange pickers as they do not have different date views other than day for now.
DateTimeRangePickers
LukasTy
left a comment
There was a problem hiding this comment.
I've adjusted the approach to one that looks more correct to me.
I'm not sure why we would have differentiated the behavior based on the presence of value. 🤔
Let me know what you think about the solution. 😉
I assumed that veryfing if the value is an array (date range) would be more clear than adding a new parameter to the function to be used only in DateTimePickers, since the view verification was done in |
Fixes #14334.
For
DateTimeRangePickersthe ["day"] case returns an incorrect format.