From 670a2ded473dd4c68095240622e24cd9e71f0d22 Mon Sep 17 00:00:00 2001 From: Derek Burgman Date: Fri, 15 Jul 2022 16:08:34 -0500 Subject: [PATCH] fix: removed unnecessary offset in daysBetween --- src/dateutil.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dateutil.ts b/src/dateutil.ts index 59cbcc6d..4ebc94be 100644 --- a/src/dateutil.ts +++ b/src/dateutil.ts @@ -86,10 +86,12 @@ export const tzOffset = function (date: Date) { export const daysBetween = function (date1: Date, date2: Date) { // The number of milliseconds in one day // Convert both dates to milliseconds - const date1ms = date1.getTime() - tzOffset(date1) - const date2ms = date2.getTime() - tzOffset(date2) + const date1ms = date1.getTime() + const date2ms = date2.getTime() + // Calculate the difference in milliseconds const differencems = date1ms - date2ms + // Convert back to days and return return Math.round(differencems / ONE_DAY) }