From 0f93beb0e468bf705a73972ad11f5c6a82ddc311 Mon Sep 17 00:00:00 2001 From: Maximilian Pott Date: Wed, 22 Nov 2023 12:37:20 +0100 Subject: [PATCH] Fix timezone issue Now negative timezone offsets no longer result in `+-number` --- src/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.ts b/src/common.ts index b3cfee8..933b01d 100644 --- a/src/common.ts +++ b/src/common.ts @@ -76,7 +76,7 @@ export const getTodayAsStartEndDates = (): StartEndDates => { */ export const getTimezone = (date: Date): string => { const tzoff = date.getTimezoneOffset(); - const h = Math.floor(tzoff / 60); + const h = Math.floor(Math.abs(tzoff) / 60); const m = tzoff % 60; return (tzoff < 0 ? '+' : '-') + h.toString().padStart(2, '0') + m.toString().padStart(2, '0'); }