fix(prompt): use UTC day-of-week to match UTC date/time stamp
P2-24: now.getDay() returns local time weekday but the stamp reads 'UTC', producing off-by-one-day errors near UTC midnight. Switch to now.getUTCDay().
This commit is contained in:
1 parent
0706ad78bb
commit
f468f7c238
1 file changed
+2
-1
@@ -76,7 +76,8 @@ export function buildSystemPrompt(ctx: PromptContext): string {
|
||||
const now = new Date();
|
||||
const dateStr = now.toISOString().split("T")[0];
|
||||
const timeStr = now.toISOString().split("T")[1]?.slice(0, 5) ?? "00:00";
|
||||
const dayOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][now.getDay()];
|
||||
// Use UTC day-of-week to stay consistent with the UTC date/time stamp below.
|
||||
const dayOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][now.getUTCDay()];
|
||||
|
||||
sections.push(`# Current Date & Time
|
||||
Today is ${dayOfWeek}, ${dateStr} at ${timeStr} UTC.
|
||||
|
||||
Reference in new issue
Block a user