From ac42283f190a37266d5684d10a0e3a91a48dea60 Mon Sep 17 00:00:00 2001 From: Jaakko Heusala Date: Tue, 10 Sep 2024 20:19:05 +0300 Subject: [PATCH] Added equalization function for dates without milliseconds --- types/Date.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/Date.ts b/types/Date.ts index a65bbdc..da89faa 100644 --- a/types/Date.ts +++ b/types/Date.ts @@ -60,6 +60,10 @@ export function isIsoDateStringWithMilliseconds (value: unknown): value is IsoDa return d.toISOString() === value; } +export function isIsoDateEqualWithoutMilliseconds (a: any, b: any) : boolean { + return parseIsoDateStringWithMilliseconds(a, true) === parseIsoDateStringWithMilliseconds(b, true); +} + export function parseIsoDateStringWithMilliseconds ( value: any, trimFractions ?: boolean