Merge pull request #932 from Luodian/feat/add-date-to-omo-env
Add current date to omo-env context
This commit is contained in:
commit
3a3794a0ce
@ -99,7 +99,14 @@ export function createEnvContext(): string {
|
|||||||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||||
const locale = Intl.DateTimeFormat().resolvedOptions().locale
|
const locale = Intl.DateTimeFormat().resolvedOptions().locale
|
||||||
|
|
||||||
const timeStr = now.toLocaleTimeString("en-US", {
|
const dateStr = now.toLocaleDateString(locale, {
|
||||||
|
weekday: "short",
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
})
|
||||||
|
|
||||||
|
const timeStr = now.toLocaleTimeString(locale, {
|
||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit",
|
minute: "2-digit",
|
||||||
second: "2-digit",
|
second: "2-digit",
|
||||||
@ -108,6 +115,7 @@ export function createEnvContext(): string {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
<omo-env>
|
<omo-env>
|
||||||
|
Current date: ${dateStr}
|
||||||
Current time: ${timeStr}
|
Current time: ${timeStr}
|
||||||
Timezone: ${timezone}
|
Timezone: ${timezone}
|
||||||
Locale: ${locale}
|
Locale: ${locale}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user