Open History to see the last commit
1import { describe, expect, it } from "vitest";
2
3import { getTimestampFormatOptions } from "./timestampFormat";
4
5describe("getTimestampFormatOptions", () => {
6 it("omits hour12 when locale formatting is requested", () => {
7 expect(getTimestampFormatOptions("locale", true)).toEqual({
8 hour: "numeric",
9 minute: "2-digit",
10 second: "2-digit",
11 });
12 });
13
14 it("builds a 12-hour formatter with seconds when requested", () => {
15 expect(getTimestampFormatOptions("12-hour", true)).toEqual({
16 hour: "numeric",
17 minute: "2-digit",
18 second: "2-digit",
19 hour12: true,
20 });
21 });
22
23 it("builds a 24-hour formatter without seconds when requested", () => {
24 expect(getTimestampFormatOptions("24-hour", false)).toEqual({
25 hour: "numeric",
26 minute: "2-digit",
27 hour12: false,
28 });
29 });
30});