Auto-reply: include weekday in envelope timestamps (#12438)

This commit is contained in:
Mariano
2026-02-09 08:55:50 +01:00
committed by GitHub
parent e4651d6afa
commit 8968d9a339
3 changed files with 52 additions and 13 deletions

View File

@@ -107,13 +107,35 @@ function formatTimestamp(
return undefined;
}
const zone = resolveEnvelopeTimezone(resolved);
if (zone.mode === "utc") {
return formatUtcTimestamp(date);
// Include a weekday prefix so models do not need to derive DOW from the date
// (small models are notoriously unreliable at that).
const weekday = (() => {
try {
if (zone.mode === "utc") {
return new Intl.DateTimeFormat("en-US", { timeZone: "UTC", weekday: "short" }).format(date);
}
if (zone.mode === "local") {
return new Intl.DateTimeFormat("en-US", { weekday: "short" }).format(date);
}
return new Intl.DateTimeFormat("en-US", { timeZone: zone.timeZone, weekday: "short" }).format(
date,
);
} catch {
return undefined;
}
})();
const formatted =
zone.mode === "utc"
? formatUtcTimestamp(date)
: zone.mode === "local"
? formatZonedTimestamp(date)
: formatZonedTimestamp(date, { timeZone: zone.timeZone });
if (!formatted) {
return undefined;
}
if (zone.mode === "local") {
return formatZonedTimestamp(date);
}
return formatZonedTimestamp(date, { timeZone: zone.timeZone });
return weekday ? `${weekday} ${formatted}` : formatted;
}
export function formatAgentEnvelope(params: AgentEnvelopeParams): string {