feat: standardize timestamps to UTC

This commit is contained in:
Peter Steinberger
2026-01-05 23:02:13 +00:00
parent f790f3f3ba
commit ac3dedaa1b
15 changed files with 140 additions and 54 deletions

View File

@@ -19,12 +19,12 @@ describe("formatAgentEnvelope", () => {
process.env.TZ = originalTz;
expect(body).toMatch(
/^\[WebChat user1 mac-mini 10\.0\.0\.5 2025-01-02T03:04\+00:00\{.+\}\] hello$/,
expect(body).toBe(
"[WebChat user1 mac-mini 10.0.0.5 2025-01-02T03:04Z] hello",
);
});
it("formats timestamps in local time (not UTC)", () => {
it("formats timestamps in UTC regardless of local timezone", () => {
const originalTz = process.env.TZ;
process.env.TZ = "America/Los_Angeles";
@@ -37,9 +37,7 @@ describe("formatAgentEnvelope", () => {
process.env.TZ = originalTz;
expect(body).toBe(
"[WebChat 2025-01-01T19:04-08:00{America/Los_Angeles}] hello",
);
expect(body).toBe("[WebChat 2025-01-02T03:04Z] hello");
});
it("handles missing optional fields", () => {