fix: use toDateString() instead of toISOString() in system prompt to preserve caching

The editor context change in PR #6151 switched from Today's date (toDateString)
to Current time (toISOString), which breaks prompt caching because the system
prompt now changes every second instead of once per day.

This changes it back to date-only format while keeping all other editor context
improvements.
This commit is contained in:
Mark IJbema
2026-02-24 08:34:32 +01:00
parent 1cdad80eac
commit c619d67061
@@ -6,9 +6,9 @@ export interface EditorContext {
timezone?: string
}
function formatTime(timezone?: string): string[] {
function formatDate(timezone?: string): string[] {
const now = new Date()
const lines = [` Current time: ${now.toISOString()}`]
const lines = [` Today's date: ${now.toDateString()}`]
if (timezone) {
const offset = -now.getTimezoneOffset()
const sign = offset >= 0 ? "+" : "-"
@@ -24,7 +24,7 @@ function formatTime(timezone?: string): string[] {
* Returns an array of pre-formatted ` key: value` strings.
*/
export function editorContextEnvLines(ctx?: EditorContext): string[] {
const lines = formatTime(ctx?.timezone)
const lines = formatDate(ctx?.timezone)
if (ctx?.shell) {
lines.push(` Default shell: ${ctx.shell}`)
}