π File detail
constants/common.ts
π§© .tsπ 34 linesπΎ 1,516 bytesπ text
β Back to All Filesπ― Use case
This file lives under βconstants/β, which covers static strings, built-in prompts, spinners, and style constants. On the API surface it exposes getLocalISODate, getSessionStartDate, and getLocalMonthYear β mainly functions, hooks, or classes. Dependencies touch lodash-es.
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import memoize from 'lodash-es/memoize.js' // This ensures you get the LOCAL date in ISO format export function getLocalISODate(): string { // Check for ant-only date override
π€ Exports (heuristic)
getLocalISODategetSessionStartDategetLocalMonthYear
π External import roots
Package roots from from "β¦" (relative paths omitted).
lodash-es
π₯οΈ Source preview
import memoize from 'lodash-es/memoize.js'
// This ensures you get the LOCAL date in ISO format
export function getLocalISODate(): string {
// Check for ant-only date override
if (process.env.CLAUDE_CODE_OVERRIDE_DATE) {
return process.env.CLAUDE_CODE_OVERRIDE_DATE
}
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// Memoized for prompt-cache stability β captures the date once at session start.
// The main interactive path gets this behavior via memoize(getUserContext) in
// context.ts; simple mode (--bare) calls getSystemPrompt per-request and needs
// an explicit memoized date to avoid busting the cached prefix at midnight.
// When midnight rolls over, getDateChangeAttachments appends the new date at
// the tail (though simple mode disables attachments, so the trade-off there is:
// stale date after midnight vs. ~entire-conversation cache bust β stale wins).
export const getSessionStartDate = memoize(getLocalISODate)
// Returns "Month YYYY" (e.g. "February 2026") in the user's local timezone.
// Changes monthly, not daily β used in tool prompts to minimize cache busting.
export function getLocalMonthYear(): string {
const date = process.env.CLAUDE_CODE_OVERRIDE_DATE
? new Date(process.env.CLAUDE_CODE_OVERRIDE_DATE)
: new Date()
return date.toLocaleString('en-US', { month: 'long', year: 'numeric' })
}