Fixed timezone adjust
This commit is contained in:
parent
ff4401934c
commit
0fb1e13ba0
@ -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",
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user