From e824b0c5a2e63ce4fbe0f904aa3d24654fc1c89d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Godoi?= Date: Tue, 26 May 2026 13:31:26 -0300 Subject: [PATCH] Fixed #8534 - DatePicker: manual input reverts to previous 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. --- packages/primevue/src/datepicker/DatePicker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/primevue/src/datepicker/DatePicker.vue b/packages/primevue/src/datepicker/DatePicker.vue index 65e3dd7487..0cb853709e 100755 --- a/packages/primevue/src/datepicker/DatePicker.vue +++ b/packages/primevue/src/datepicker/DatePicker.vue @@ -1969,7 +1969,7 @@ export default { throw 'Invalid Time'; } - this.pm = ampm.toLowerCase() === this.$primevue.config.locale.pm.toLowerCase() || ampm.toLowerCase() === 'pm'; + this.pm = !!ampm && (ampm.toLowerCase() === this.$primevue.config.locale.pm.toLowerCase() || ampm.toLowerCase() === 'pm'); let time = this.parseTime(timeString); value.setHours(time.hour);