mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 09:59:00 +02:00
✨ Use only geographic time zones (#1033)
This commit is contained in:
parent
39a22acaa7
commit
27dda65ca5
31 changed files with 1416 additions and 618 deletions
38
apps/web/src/utils/date-time-utilts.test.ts
Normal file
38
apps/web/src/utils/date-time-utilts.test.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import dayjs from "dayjs";
|
||||
import timezone from "dayjs/plugin/timezone";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { supportedTimeZones } from "@/utils/supported-time-zones";
|
||||
|
||||
import { resolveGeographicTimeZone } from "./date-time-utils";
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
describe("resolveGeographicTimezone", () => {
|
||||
it("should return same timezone when given a geographic timezone", () => {
|
||||
const browserTimeZone = resolveGeographicTimeZone("Europe/London");
|
||||
|
||||
// Assert that the browser time zone is one of the supported time zones
|
||||
expect(browserTimeZone).toBe("Europe/London");
|
||||
});
|
||||
it("should return a supported timezone when given a fixed offset timezone", () => {
|
||||
const browserTimeZone = resolveGeographicTimeZone("Etc/GMT-1");
|
||||
|
||||
// Assert that the browser time zone is one of the supported time zones
|
||||
expect(supportedTimeZones.includes(browserTimeZone)).toBe(true);
|
||||
});
|
||||
it("should return a supported timezone when given GMT", () => {
|
||||
const browserTimeZone = resolveGeographicTimeZone("GMT");
|
||||
|
||||
// Assert that the browser time zone is one of the supported time zones
|
||||
expect(supportedTimeZones.includes(browserTimeZone)).toBe(true);
|
||||
});
|
||||
it("should return a supported timezone when given UTC", () => {
|
||||
const browserTimeZone = resolveGeographicTimeZone("UTC");
|
||||
|
||||
// Assert that the browser time zone is one of the supported time zones
|
||||
expect(supportedTimeZones.includes(browserTimeZone)).toBe(true);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue