Skip to content

Commit f501c93

Browse files
committed
Add the current time to the system prompt
1 parent bc7dee6 commit f501c93

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/core/Cline.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,6 +2462,22 @@ export class Cline {
24622462
details += terminalDetails
24632463
}
24642464

2465+
// Add current time information with timezone
2466+
const now = new Date()
2467+
const formatter = new Intl.DateTimeFormat(undefined, {
2468+
year: 'numeric',
2469+
month: 'numeric',
2470+
day: 'numeric',
2471+
hour: 'numeric',
2472+
minute: 'numeric',
2473+
second: 'numeric',
2474+
hour12: true
2475+
})
2476+
const timeZone = formatter.resolvedOptions().timeZone
2477+
const timeZoneOffset = -now.getTimezoneOffset() / 60 // Convert to hours and invert sign to match conventional notation
2478+
const timeZoneOffsetStr = `${timeZoneOffset >= 0 ? '+' : ''}${timeZoneOffset}:00`
2479+
details += `\n\n# Current Time\n${formatter.format(now)} (${timeZone}, UTC${timeZoneOffsetStr})`
2480+
24652481
if (includeFileDetails) {
24662482
details += `\n\n# Current Working Directory (${cwd.toPosix()}) Files\n`
24672483
const isDesktop = arePathsEqual(cwd, path.join(os.homedir(), "Desktop"))

0 commit comments

Comments
 (0)