fix terminal system lines to use server time

This commit is contained in:
npc0-hue
2026-08-24 14:07:33 +08:00
parent 504387c657
commit 3e00737267
4 changed files with 52 additions and 28 deletions
+6 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { formatTerminalLogTime } from "./logTime";
import { formatTerminalLogTime, formatTerminalServerTime } from "./logTime";
describe("formatTerminalLogTime", () => {
it("uses the SCUM log clock instead of the browser timezone", () => {
@@ -11,4 +11,9 @@ describe("formatTerminalLogTime", () => {
it("falls back to the event timestamp for generic logs", () => {
expect(formatTerminalLogTime("not-a-timestamp")).toBe("时间未知");
});
it("does not use the browser clock before the server clock is synchronized", () => {
expect(formatTerminalServerTime()).toBe("时间同步中");
expect(formatTerminalServerTime("2026-08-14T00:00:00Z")).toBe(formatTerminalLogTime("2026-08-14T00:00:00Z"));
});
});