File size: 696 Bytes
3201ca6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { describe, expect, it } from "vitest";
import { formatEventTimestamp } from "#/utils/format-event-timestamp";
describe("formatEventTimestamp", () => {
it.each(["en", "zh-CN"])("uses the supplied %s locale", (locale) => {
const timestamp = "2026-04-16T19:32:29.828Z";
expect(formatEventTimestamp(timestamp, locale)).toBe(
new Date(timestamp).toLocaleString(locale, {
dateStyle: "medium",
timeStyle: "short",
}),
);
});
it("reads an offset-less agent-server timestamp as UTC", () => {
expect(formatEventTimestamp("2026-04-16T19:32:29.828069", "en")).toBe(
formatEventTimestamp("2026-04-16T19:32:29.828069Z", "en"),
);
});
});
|