From 66f13e9ef0e0cb6c2c323806baf5b0d2ab2446e4 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 16 Feb 2023 19:55:30 +0200 Subject: [PATCH] RED-6122: Add new comparator for form values. --- src/lib/utils/functions.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/utils/functions.ts b/src/lib/utils/functions.ts index 3e83e7d..425c4ab 100644 --- a/src/lib/utils/functions.ts +++ b/src/lib/utils/functions.ts @@ -116,6 +116,10 @@ export function hasFormChanged(form: UntypedFormGroup, initialFormValue: Record< if (!(updatedValue as Dayjs).isSame(dayjs(initialValue), 'day')) { return true; } + } else if (updatedValue instanceof Date && dayjs(initialValue as any).isValid()) { + if (!dayjs(updatedValue).isSame(dayjs(initialValue as any), 'day')) { + return true; + } } else { return true; }