feat: pass language to formatTime for localization
This commit is contained in:
@@ -178,7 +178,7 @@ export class Panel {
|
||||
tempCard.innerHTML = createCard({
|
||||
icon: '❓',
|
||||
content: `Question: ${question}`,
|
||||
meta: formatTime(),
|
||||
meta: formatTime(this.#config.language ?? 'en-US'),
|
||||
type: 'question',
|
||||
})
|
||||
const cardElement = tempCard.firstElementChild as HTMLElement
|
||||
@@ -579,7 +579,7 @@ export class Panel {
|
||||
/** Create cards for a history event */
|
||||
#createHistoryCards(event: PanelAgentAdapter['history'][number], stepNumber: number): string[] {
|
||||
const cards: string[] = []
|
||||
const time = formatTime()
|
||||
const time = formatTime(this.#config.language ?? 'en-US')
|
||||
const meta = this.#i18n.t('ui.panel.step', {
|
||||
number: stepNumber.toString(),
|
||||
time,
|
||||
|
||||
@@ -33,8 +33,8 @@ export function createCard({ icon, content, meta, type }: CardOptions): string {
|
||||
}
|
||||
|
||||
/** Format timestamp for cards */
|
||||
export function formatTime(): string {
|
||||
return new Date().toLocaleTimeString('zh-CN', {
|
||||
export function formatTime(locale: string = 'en-US'): string {
|
||||
return new Date().toLocaleTimeString(locale, {
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user