Skip to content

Fixed #8534 - DatePicker: manual input reverts to previous value in t…#8584

Open
tomasgodoi wants to merge 1 commit into
primefaces:masterfrom
tomasgodoi:fix/8534-datepicker-timeonly-manual-input
Open

Fixed #8534 - DatePicker: manual input reverts to previous value in t…#8584
tomasgodoi wants to merge 1 commit into
primefaces:masterfrom
tomasgodoi:fix/8534-datepicker-timeonly-manual-input

Conversation

@tomasgodoi
Copy link
Copy Markdown

…imeOnly (24h) mode

When typing a time in a DatePicker configured with timeOnly and the default 24-hour format, the parsing regex in parseDateTime does not capture an am/pm group, so populateTime is called with ampm === undefined. The subsequent ampm.toLowerCase() call then throws a TypeError, which is silently swallowed by the try/catch in onInput, leaving the model unchanged. On blur the input is reset from rawValue, so the typed value visibly reverts to the previous one.

Guard the pm assignment so it only inspects ampm when defined.

Defect Fixes

When submitting a PR, please also create an issue documenting the error.

Feature Requests

Due to company policy, we are unable to accept feature request PRs with significant changes as such cases has to be implemented by our team following our own processes.

Closes #8534

…value in timeOnly (24h) mode

When typing a time in a DatePicker configured with `timeOnly` and the
default 24-hour format, the parsing regex in `parseDateTime` does not
capture an am/pm group, so `populateTime` is called with `ampm === undefined`.
The subsequent `ampm.toLowerCase()` call then throws a TypeError, which
is silently swallowed by the try/catch in `onInput`, leaving the model
unchanged. On blur the input is reset from `rawValue`, so the typed
value visibly reverts to the previous one.

Guard the `pm` assignment so it only inspects `ampm` when defined.
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.

DatePicker manual input issue.

2 participants