feat: append UTC time alongside local time in shared Current time lines (#32423)

Merged via squash.

Prepared head SHA: 9e8ec13933
Co-authored-by: jriff <50276+jriff@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
Jacob Riff
2026-03-05 14:26:34 -08:00
committed by GitHub
parent 49acb07f9f
commit aad372e15f
6 changed files with 15 additions and 10 deletions

View File

@@ -20,8 +20,9 @@ describe("resolveMemoryFlushPromptForRun", () => {
});
expect(prompt).toContain("memory/2026-02-16.md");
expect(prompt).toContain("Current time:");
expect(prompt).toContain("(America/New_York)");
expect(prompt).toContain(
"Current time: Monday, February 16th, 2026 — 10:00 AM (America/New_York) / 2026-02-16 15:00 UTC",
);
});
it("does not append a duplicate current time line", () => {

View File

@@ -203,7 +203,7 @@ Never modify memory/YYYY-MM-DD.md destructively.
`;
fs.writeFileSync(path.join(tmpDir, "AGENTS.md"), content);
const cfg = {
agents: { defaults: { userTimezone: "America/New_York" } },
agents: { defaults: { userTimezone: "America/New_York", timeFormat: "12" } },
} as OpenClawConfig;
// 2026-03-03 14:00 UTC = 2026-03-03 09:00 EST
const nowMs = Date.UTC(2026, 2, 3, 14, 0, 0);
@@ -211,8 +211,9 @@ Never modify memory/YYYY-MM-DD.md destructively.
expect(result).not.toBeNull();
expect(result).toContain("memory/2026-03-03.md");
expect(result).not.toContain("memory/YYYY-MM-DD.md");
expect(result).toContain("Current time:");
expect(result).toContain("America/New_York");
expect(result).toContain(
"Current time: Tuesday, March 3rd, 2026 — 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC",
);
});
it("appends current time line even when no YYYY-MM-DD placeholder is present", async () => {

View File

@@ -11,13 +11,14 @@ describe("buildBareSessionResetPrompt", () => {
it("appends current time line so agents know the date", () => {
const cfg = {
agents: { defaults: { userTimezone: "America/New_York" } },
agents: { defaults: { userTimezone: "America/New_York", timeFormat: "12" } },
} as OpenClawConfig;
// 2026-03-03 14:00 UTC = 2026-03-03 09:00 EST
const nowMs = Date.UTC(2026, 2, 3, 14, 0, 0);
const prompt = buildBareSessionResetPrompt(cfg, nowMs);
expect(prompt).toContain("Current time:");
expect(prompt).toContain("America/New_York");
expect(prompt).toContain(
"Current time: Tuesday, March 3rd, 2026 — 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC",
);
});
it("does not append a duplicate current time line", () => {