import { describe, expect, it } from "vitest" import { tranformToUTC } from "#/utils/date" describe("transform Beijing time to UTC in different timezone", () => { const a = "2024/10/3 12:26:16" const b = 1727929576000 it("in UTC", () => { Object.assign(process.env, { TZ: "UTC" }) const date = tranformToUTC(a) expect(date).toBe(b) }) it("in Beijing", () => { Object.assign(process.env, { TZ: "Asia/Shanghai" }) const date = tranformToUTC(a) expect(date).toBe(b) }) it("in New York", () => { Object.assign(process.env, { TZ: "America/New_York" }) const date = tranformToUTC(a) expect(date).toBe(b) }) })