From e38206a59d4b354c864d27f194b0067c558afdea Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Thu, 12 Oct 2023 18:50:00 +0530 Subject: [PATCH] correct for timezone --- src/Utils/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index b021aaa1b00..e9d8cbbc00c 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -85,8 +85,9 @@ export const formatDateTime = (date: DateLike, format?: string) => { return obj.format(format); } - // formatDate if hours, minutes and seconds are 0 - if (obj.hour() === 0 && obj.minute() === 0 && obj.second() === 0) { + // formatDate if hours, minutes and seconds are 0 (after timezone correction) + const utc = obj.subtract(obj.utcOffset(), "minute"); + if (utc.hour() === 0 && utc.minute() === 0 && utc.second() === 0) { return obj.format(DATE_FORMAT); }