I would like to share with you a problem I was having while using the DatePicker component from Ant Design – React.
The first challenge was to add a mask to the manually entered date in the input field.
The second challenge was to accept changes in the input without having to press the date confirmation button.
2
Answers
Both issues were resolved as follows:
public/index.html
And finally:
It may not be the best way to solve the problem, but it worked. I'm open to suggestions if anyone has a better idea of how to do it.
Just create an array of accepted date formats
And assign it to DatePicker format:
Now if you type only numbers in your date field and press
enter
the date will be formated to the first format available in your array.