question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can type more than 4 digits into the year field.

See original GitHub issue

Typing, for example, 04/14/20123 looks like it is accepted. However, by inspecting the hidden , I can see that the real date value stored is 04/14/0123.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
JamieDixoncommented, Mar 30, 2022

@ivanjonas Perfect, thank you! I see now that the year 100,000 is perfectly acceptable as a year, although undesirable in our particular case. This solves the problem so thanks for coming back to me, I appreciate your time.

2reactions
ivanjonascommented, Mar 25, 2022

Turns out it was pretty simple and straightforward.

const MAX_DATE = new Date('9999-12-31T23:59:59.999');

<DateTimePicker
  value={isValidDate ? value : new Date()}
  minDate={minValue}
  maxDate={MAX_DATE}
  ...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to stop typing more than 4 digit in year textbox. #212
I have added below code in my project, but still I am able to type more than 4 digit. ... Can any one...
Read more >
Help text for 4 digit year - User Experience Stack Exchange
Save this question. Show activity on this post. I am designing an input field for a year, that needs to be 4 digits....
Read more >
"Date and time" Form API element allows to type 6 digit year ...
The core date Form API element (and therefore, field widgets) allows 6 digits for the year. It should be limited to 4 digits....
Read more >
Trim %Year% if beyond 4 characters - Mp3tag Community
This will trim everything after the first 4 digits for those files where the year is greater than 4 characters in length.
Read more >
Control data entry formats with input masks - Microsoft Support
For example, you can use an input mask to make sure that people enter correctly formatted phone numbers into a phone number field....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found