From 0d2dcbfa49568aed96fa6630a39e0406252d9d6d Mon Sep 17 00:00:00 2001 From: Dominic R Date: Mon, 19 Jan 2026 11:03:03 -0500 Subject: [PATCH] web/forms: fix invalid date error for empty datetime-local inputs (#19561) * web/forms: fix invalid date error for empty datetime-local inputs Overview: When a datetime-local input is empty, `valueAsNumber` returns `NaN` and `new Date("")` creates an Invalid Date. Previously, form serialization passed these invalid dates to the API, which caused "RangeError: Invalid time value" when `toISOString()` was called. Now empty datetime inputs correctly serialize to `null`. Testing: 1. Go to Directory > Tokens and App passwords 2. Create or edit a token 3. Uncheck the "Expiring" checkbox 4. Save the token 5. Verify no error occurs and token is saved without expiry Motivation: Closes: https://github.com/goauthentik/authentik/issues/19558 * web: lint --- web/src/elements/forms/Form.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/elements/forms/Form.ts b/web/src/elements/forms/Form.ts index 47eee9cc06..3d18d095fa 100644 --- a/web/src/elements/forms/Form.ts +++ b/web/src/elements/forms/Form.ts @@ -114,9 +114,10 @@ export function serializeForm>(elements: Iterable>(elements: Iterable