Skip to content

Invalid cursor Postion #103

@Gagauz2010

Description

@Gagauz2010

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions