Cannot format KeyboardDatePicker date with text characters
See original GitHub issueme right now:
Environment
Tech | Version |
---|---|
@material-ui/pickers | 3.0.0 |
material-ui | 4.0.1 |
React | 16.8.6 |
Browser | Chrome 74.0.3729.169 |
Peer library | date-fns |
Steps to reproduce
- Use
MuiPickersUtilsProvider
withDateFnsUtils
utils. - Use
KeyboardDatePicker
withformat="MMM dd, yyyy"
attribute and value. - Attempt to adjust date via keyboard.
Expected behavior
One should be able to edit the text and input a new date.
For example, let’s work with the date “Dec 17, 2018”.
If I wished to adjust this date via keyboard, I would expect to be able to delete “2018” from the string and add “2017” instead. I would assume that the rest of the string would remain the same.
Actual behavior
When the text date is adjusted via keyboard, characters from the date are removed. After typing the first character, the string changes to “Dec 1, 7, 2”. When a second character is typed, the string changes to “Dec , 1, 7”
Live example
https://codesandbox.io/embed/materialuipickersusagedemo-vv0ou?fontsize=14
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Cannot format KeyboardDatePicker date with text characters
Use KeyboardDatePicker with format="MMM dd, yyyy" attribute and value. Attempt to adjust date via keyboard. Expected behavior. One should be ...
Read more >Issue in Material UI keyboard date picker for type a value
1 Answer 1 · I don't want to set today date in default I want to set the date format for inial it...
Read more >KeyboardDatePicker API - Material-UI Pickers
Name Type Default
onChange * (date: DateIOType, value?: string | null) => void
value * ParsableDate
allowKeyboardControl boolean true
Read more >Imported data date formatted as text Issue|How to Fix in 2 min
Sometimes, when we import data from a server, the date is formatted as text and then we are unable to do any formatting...
Read more >DatePicker API - MUI X
Name Type Default
onChange * func
renderInput * func
acceptRegex RegExp /\dap/gi
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in v4
Got it. We definitely need to do smth with it. That’s a case when auto generated mask is not working 😃
We cannot generate all masks, so it needs to be specified manually