rifm
rifm copied to clipboard
Invalid cursor Postion
I've tried to create date text field with validation of max numbers of dates for leap years and months.
First of all I allow input maximum 31 day (or input 04 if start input with 4). if month is valid, i check maximum day count for current month. Then i check if year is leap and if month is february.
Realization sometimes is dirty, but i understand that correct caret position based on replace function.
Wrong caret position when i start typing 5, or paste 29.02.2017.
Sandbox sample: https://codesandbox.io/s/hidden-dream-3bicv
Please, can someone explain my mistake (misconception) or this is really unexpected behaviour?