mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:41:38 +00:00
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:
@@ -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", () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user