From f501c93faff947ab0779604def75dee7efacd228 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Mon, 23 Dec 2024 22:28:10 -0800 Subject: [PATCH] Add the current time to the system prompt --- src/core/Cline.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index cc1062d..343393f 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -2462,6 +2462,22 @@ export class Cline { details += terminalDetails } + // Add current time information with timezone + const now = new Date() + const formatter = new Intl.DateTimeFormat(undefined, { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + hour12: true + }) + const timeZone = formatter.resolvedOptions().timeZone + const timeZoneOffset = -now.getTimezoneOffset() / 60 // Convert to hours and invert sign to match conventional notation + const timeZoneOffsetStr = `${timeZoneOffset >= 0 ? '+' : ''}${timeZoneOffset}:00` + details += `\n\n# Current Time\n${formatter.format(now)} (${timeZone}, UTC${timeZoneOffsetStr})` + if (includeFileDetails) { details += `\n\n# Current Working Directory (${cwd.toPosix()}) Files\n` const isDesktop = arePathsEqual(cwd, path.join(os.homedir(), "Desktop"))