Fixed timezone adjust
All checks were successful
Build / Build NPM Project (push) Successful in 1m12s
Build / Tag Version (push) Successful in 11s
Build / Publish Documentation (push) Successful in 2m4s

This commit is contained in:
Zakary Timson 2024-11-20 10:04:17 -05:00
parent ff4401934c
commit 0fb1e13ba0
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/utils", "name": "@ztimson/utils",
"version": "0.22.10", "version": "0.22.11",
"description": "Utility library", "description": "Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@ -22,8 +22,8 @@ export function adjustedInterval(cb: Function, ms: number) {
export function adjustTz(date: Date, offset: number) { export function adjustTz(date: Date, offset: number) {
const currentOffset = date.getTimezoneOffset(); const currentOffset = date.getTimezoneOffset();
offset = currentOffset - offset * 60; const adjustedOffset = offset * 60;
return new Date(date.getTime() + offset * 60000); return new Date(date.getTime() + (currentOffset - adjustedOffset) * 60000);
} }
/** /**