From b4da667e5a4264c08e0e542c829d8de32b65cc1c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 4 Aug 2021 15:33:33 +0100 Subject: [PATCH] Use real dae object for default date value if already parsed --- packages/standard-components/src/forms/DateTimeField.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/forms/DateTimeField.svelte b/packages/standard-components/src/forms/DateTimeField.svelte index 4d722786fb..87089114fc 100644 --- a/packages/standard-components/src/forms/DateTimeField.svelte +++ b/packages/standard-components/src/forms/DateTimeField.svelte @@ -17,7 +17,10 @@ return null } let date - if (isNaN(val)) { + if (val instanceof Date) { + // Use real date obj if already parsed + date = val + } else if (isNaN(val)) { // Treat as date string of some sort date = new Date(val) } else {