Skip to content
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] manual year addition only allows when 3 digits entered #16837

Open
MainaMwangiy opened this issue Mar 5, 2025 · 1 comment
Open
Labels
bug 🐛 Something doesn't work component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@MainaMwangiy
Copy link

MainaMwangiy commented Mar 5, 2025

Steps to reproduce

Steps:

  1. Check issue on link: https://stackblitz.com/edit/react-omshxuse?file=Demo.js

Current behavior

When I manually type date like this 11-11-0111 it accepts 0111 as an year. If I enter 11-11-0001 it detects this as null date.

Expected behavior

I want to ensure that I catch in the validation a date like (11-11-0001, 11-11-0011, 11-11-0111) as invalid. Right now it considers it as null and I am able to save as null. How can I catch this such that if the year entered is not up to 4 digits (e.g. four digit years like 11-11-1111 or 11-11-2024), then the date is considered invalid? How can I achieve that?

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: year manual date picker mui

@MainaMwangiy MainaMwangiy added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 5, 2025
@github-actions github-actions bot added the component: pickers This is the name of the generic UI component, not the React module! label Mar 5, 2025
@michelengelen
Copy link
Member

That's a great question.
We do not fire the onChange for year values with less than 3 characters. My guess is that we do not any value with less than 3 chars a valid yearpart, but @LukasTy is the expert here. Could you elaborate on this @LukasTy ?

@michelengelen michelengelen added the component: date picker This is the name of the generic UI component, not the React module! label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants