From 0fb1e13ba013b59d58bf9fefdf9185d34652ad38 Mon Sep 17 00:00:00 2001 From: ztimson Date: Wed, 20 Nov 2024 10:04:17 -0500 Subject: [PATCH] Fixed timezone adjust --- package.json | 2 +- src/time.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2552b09..814d94d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.22.10", + "version": "0.22.11", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/time.ts b/src/time.ts index d51b72c..a6ddff5 100644 --- a/src/time.ts +++ b/src/time.ts @@ -22,8 +22,8 @@ export function adjustedInterval(cb: Function, ms: number) { export function adjustTz(date: Date, offset: number) { const currentOffset = date.getTimezoneOffset(); - offset = currentOffset - offset * 60; - return new Date(date.getTime() + offset * 60000); + const adjustedOffset = offset * 60; + return new Date(date.getTime() + (currentOffset - adjustedOffset) * 60000); } /**