refactor: update timestamp handling in session management and chat components

This commit is contained in:
Soulter
2025-11-20 17:02:01 +08:00
parent 1d3928d145
commit cb087b5ff9
5 changed files with 9 additions and 24 deletions
@@ -54,7 +54,7 @@
{{ item.display_name || tm('conversation.newConversation') }}
</v-list-item-title>
<v-list-item-subtitle v-if="!sidebarCollapsed || isMobile" class="timestamp">
{{ formatDate(item.updated_at) }}
{{ new Date(item.updated_at).toLocaleString() }}
</v-list-item-subtitle>
<template v-if="!sidebarCollapsed || isMobile" v-slot:append>
@@ -159,21 +159,6 @@ function handleSidebarMouseLeave() {
}
sidebarHoverExpanded.value = false;
}
function formatDate(timestamp: number): string {
const date = new Date(timestamp * 1000);
const options: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
};
const locale = t('core.common.locale') || 'zh-CN';
return date.toLocaleString(locale, options).replace(/\//g, '-').replace(/, /g, ' ');
}
</script>
<style scoped>
+1 -1
View File
@@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
export interface Session {
session_id: string;
display_name: string;
updated_at: number;
updated_at: string;
}
export function useSessions(chatboxMode: boolean = false) {