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