mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-02 04:41:11 +00:00
fix: unify log timestamp offsets (#38904) (thanks @sahilsatralkar)
This commit is contained in:
@@ -117,7 +117,7 @@ describe("logs cli", () => {
|
||||
|
||||
it("formats UTC timestamp in pretty mode", () => {
|
||||
const result = formatLogTimestamp("2025-01-01T12:00:00.000Z", "pretty");
|
||||
expect(result).toBe("12:00:00");
|
||||
expect(result).toBe("12:00:00+00:00");
|
||||
});
|
||||
|
||||
it("formats local time in plain mode when localTime is true", () => {
|
||||
@@ -132,13 +132,8 @@ describe("logs cli", () => {
|
||||
it("formats local time in pretty mode when localTime is true", () => {
|
||||
const utcTime = "2025-01-01T12:00:00.000Z";
|
||||
const result = formatLogTimestamp(utcTime, "pretty", true);
|
||||
// Should be HH:MM:SS format
|
||||
expect(result).toMatch(/^\d{2}:\d{2}:\d{2}$/);
|
||||
// Should be different from UTC time (12:00:00) if not in UTC timezone
|
||||
const tzOffset = new Date(utcTime).getTimezoneOffset();
|
||||
if (tzOffset !== 0) {
|
||||
expect(result).not.toBe("12:00:00");
|
||||
}
|
||||
// Should be HH:MM:SS±HH:MM format with timezone offset.
|
||||
expect(result).toMatch(/^\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$/);
|
||||
});
|
||||
|
||||
it.each([
|
||||
|
||||
Reference in New Issue
Block a user