-
-
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
[fields] Fix new index calculation on letter section #13310
[fields] Fix new index calculation on letter section #13310
Conversation
Deploy preview: https://deploy-preview-13310--material-ui-x.netlify.app/ |
packages/x-date-pickers/src/internals/hooks/useField/useField.utils.ts
Outdated
Show resolved
Hide resolved
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.
At first glance the solution makes a lot of sense.
Thanks for taking care of it!
packages/x-date-pickers/src/internals/hooks/useField/useField.utils.ts
Outdated
Show resolved
Hide resolved
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'll let @LukasTy have the final approval here, but for me it's looking great 🥳
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.
Thank you for finding and taking care of this issue! 🙏 💯 🎉
Great work! 👏
P.S. WDYT about adding a needs cherry-pick
label to cherry-pick this fix to v6.x
? 🤔
packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx
Outdated
Show resolved
Hide resolved
format: adapter.formats.year, | ||
defaultValue: adapter.date('0003-01-15'), | ||
key: 'PageDown', | ||
expectedValue: adapter.lib === 'dayjs' ? '1898' : '9998', |
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.
@flaviendelangle WDYT about making the minimum
and maximum
aware of the minDate
and maxDate
?
Didn't we do it only, because shouldDisableYear
exists? 🤔
IMHO, the current behavior seems a bit strange, especially given the differences in adapters. 🙈
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.
How would this behave for sections other than year?
For year, I do agree that having the min/max respect the validation (even if shouldDisableYear
is not supported) would be a plus.
For the other fields, I'm not sure what the exact behavior should be.
Fixes [fields][TimeField] Adapt delta calculation for meridiem #13213
Implements tests to assure no regressions and basic tests for the PageUp and PageDown support
I have followed (at least) the PR section of the contributing guide.