Skip to content

Commit

Permalink
Fix timezone issue
Browse files Browse the repository at this point in the history
Now negative timezone offsets no longer result in `+-number`
  • Loading branch information
arough007 committed Nov 22, 2023
1 parent 618ebd9 commit 0f93beb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 0f93beb

Please sign in to comment.