Reputation: 5809
I'm trying to use [react-input-mask] with a mask of
<InputMask mask='99/99/99' maskChar=''/>
This works great if a user types in 02/21/18
but if a user types in 2/9/18
then they get 29/18/
which is not very intuitive.
I'd like for them to get 02/09/18
added for them. Does anyone know if there is a way for me to achieve this. If not maybe someone could point me in the right direction to a possible solution to writing it myself?
Upvotes: 0
Views: 882
Reputation: 8418
You can use beforeMaskedValueChange
to append leading zero conditionally on input length. Of course it should be removed when a user enters 6 numbers.
Upvotes: 1