Skip to content

Commit

Permalink
fix: zonedTime
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Apr 6, 2024
1 parent ea790a7 commit 2ef5cb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/helpers/helpers.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { AuthenticationResponse } from "@common/@types";
import type { User } from "@entities";
import type { Options as ArgonOptions } from "argon2";
import { argon2id, hash, verify } from "argon2";
import { format, zonedTimeToUtc } from "date-fns-tz";
import { format, fromZonedTime } from "date-fns-tz";
import { pick } from "helper-fns";
import type { Observable } from "rxjs";
import { from } from "rxjs";
Expand Down Expand Up @@ -97,7 +97,7 @@ which is the hashed password to compare against. */
returns a new `Date` object representing the same date and time in UTC timezone. */
getTimeInUtc(date: Date | string): Date {
const thatDate = date instanceof Date ? date : new Date(date);
const currentUtcTime = zonedTimeToUtc(thatDate, "UTC");
const currentUtcTime = fromZonedTime(thatDate, "UTC");

return new Date(format(currentUtcTime, "yyyy-MM-dd HH:mm:ss"));
},
Expand Down

0 comments on commit 2ef5cb6

Please sign in to comment.