Don't rewrite the mobile input while it's being typed into by b84330808 · Pull Request #3145 · flatpickr/flatpickr · GitHub
Skip to content

Don't rewrite the mobile input while it's being typed into - #3145

Open
b84330808 wants to merge 1 commit into
flatpickr:masterfrom
b84330808:fix-3144-mobile-time-typing
Open

b84330808 wants to merge 1 commit into
flatpickr:masterfrom
b84330808:fix-3144-mobile-time-typing

Conversation

@b84330808

Copy link
Copy Markdown

Fixes #3144

On mobile, flatpickr writes the selected date back into the native time input on every change. Browsers report the value without zero seconds (01:05), but flatpickr writes 01:05:00, and Chrome treats that as a new value and resets the field you're typing in, so typing "15" into a prefilled hour ends up as 05.

This skips the write when the native input already holds the same date. Setting the date from code (setDate(), clear()) still updates it.

I tried the steps from the issue in Chromium with Android emulation (15:05 now, 05:05:00 before) and added a test that fails on master. CI is currently cancelled on PRs because of the retired ubuntu-20.04 runner (#3141 fixes that), so I ran npm test and the prettier check locally.

I used Claude Code to write this change.

…#3144)

Native time inputs report their value without zero seconds ("01:05"),
but every change event made flatpickr write it back as "01:05:00".
Chrome treats that as a new value and resets the field being edited, so
typing "15" into a prefilled hour ended up as 05.

Skip the write when the native input already holds the same date.

Fixes flatpickr#3144

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile native time input interrupts two-digit typing of a prefilled hour

1 participant