Open sakulstra opened 1 year ago
About birthdays, pickers are not the best options. We have an issue on this topic if you're interested in: #5021
I tried to do a CSS revert, but it's breaking the keyboard navigation. The modification will have to be done by a prop in the YerPicker
Currently this input is confusing for users as they have to scroll a lot.
In the last versions, I think we are automatically scrolling to today's year, which solves this part of the problem.
@alexfauquette thx for the comment. After reading this seems like a good idea to me to just change to 3 inputs :sweat_smile:
@flaviendelangle I think this feature doesn't work very well. When your min/max range don't include the current year the "topbar" will show the current year which is not selectable (like in the screenshot above) and nothing will be selected/scrolled.
When your min/max range don't include the current year the "topbar" will show the current year which is not selectable (like in the screenshot above) and nothing will be selected/scrolled.
In which case do you have a selected year that is not selectable ? We might not handle this use case correctly indeed
@flaviendelangle In the example above i have
minDate={dayjs().subtract(90, 'years')}
maxDate={dayjs().subtract(18, 'years')}
Which I think will via useNow
https://github.com/mui/mui-x/blob/next/packages/x-date-pickers/src/internals/hooks/useUtils.ts#L49 default to the current Year
which is why in the screenshot provided above https://github.com/mui/mui-x/issues/6759#issue-1437435648 although the current Year is not within the selectable range has 2022 in the "topbar". And as 2022
is selected, the autoscroll doesn't work as there's no 2022
to scroll to.
Duplicates
Latest version
Summary π‘
It would be great if i was able to render years in the opposite direction (new to old).
Examples π
In an app i'm currently working on we need peoples birthday, and expect them to be between 18 and 90 years old. When setting DatePicker
minDate
andmaxDate
accordingly the input will render sth likeWhich is a bit weird as I'd expect the sorting to be the other way around. Therefore it would be nice if i could supply a flag or add some custom behavior for the Year selection.
On a sidenote, when selecting sth like a "birthday", there's not really any need for a DateLibrary, as the output date is not a "real date" bot more of a time-zone unaware string. I think there's no way to actually use this ui component without a date library, but would be good if there was.
Motivation π¦
Currently this input is confusing for users as they have to scroll a lot.
Order ID π³ (optional)
No response