mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 17:04:58 +00:00
fix: use local timezone in console log timestamps
formatConsoleTimestamp previously used Date.toISOString() which always returns UTC time (suffixed with Z). This confused users whose local timezone differs from UTC. Now uses local time methods (getHours, getMinutes, etc.) and appends the local UTC offset (e.g. +08:00) instead of Z. The pretty style returns local HH:MM:SS. The hasTimestampPrefix regex is updated to accept both Z and +/-HH:MM offset suffixes. Closes #14699
This commit is contained in:
committed by
Peter Steinberger
parent
af172742a3
commit
468414cac4
@@ -86,7 +86,10 @@ describe("enableConsoleCapture", () => {
|
||||
console.warn("[EventQueue] Slow listener detected");
|
||||
expect(warn).toHaveBeenCalledTimes(1);
|
||||
const firstArg = String(warn.mock.calls[0]?.[0] ?? "");
|
||||
expect(firstArg.startsWith("2026-01-17T18:01:02.000Z [EventQueue]")).toBe(true);
|
||||
// Timestamp uses local time with timezone offset instead of UTC "Z" suffix
|
||||
expect(firstArg).toMatch(
|
||||
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{2}:\d{2} \[EventQueue\]/,
|
||||
);
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user