From 6be45522f40e8f3ff4daf4b3874d66f90d003b1d Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Mon, 18 Oct 2021 06:07:50 -0700 Subject: [PATCH] (ui): Fix isSameDate helper function --- ui/src/reducers/queueStatsReducer.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/reducers/queueStatsReducer.ts b/ui/src/reducers/queueStatsReducer.ts index 8d9ff64..30b8b8e 100644 --- a/ui/src/reducers/queueStatsReducer.ts +++ b/ui/src/reducers/queueStatsReducer.ts @@ -74,5 +74,11 @@ export default function queueStatsReducer( // Returns true if two timestamps are from the same date. function isSameDate(ts1: string, ts2: string): boolean { - return new Date(ts1).toDateString() === new Date(ts2).toDateString(); + const date1 = new Date(ts1); + const date2 = new Date(ts2); + return ( + date1.getUTCDate() === date2.getUTCDate() && + date1.getUTCMonth() === date2.getUTCMonth() && + date1.getUTCFullYear() === date2.getUTCFullYear() + ); }