【功能修复】修复dayjs时间格式化问题

pull/506/head
卢越 2024-08-21 22:20:10 +08:00
parent 0f2061f80a
commit 11584d3ee2
2 changed files with 3 additions and 3 deletions

View File

@ -66,10 +66,10 @@ export const defaultShortcuts = [
export function formatDate(date: Date, format?: string): string {
// 日期不存在,则返回空
if (!date) {
return ''
return '';
}
// 日期存在,则进行格式化
return date ? dayjs(date).format((format?.includes("YYYY-mm-dd") ? format.replace("YYYY-mm-dd", "YYYY-MM-DD") : format) ?? 'YYYY-MM-DD HH:mm:ss') : ''
return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : '';
}
/**

View File

@ -23,7 +23,7 @@
<div class="flex justify-between items-center w-100%">
<span class="username">{{ item.userNickname }}</span>
<span class="color-[var(--left-menu-text-color)]" style="font-size: 13px;">
{{ formatPast(item.lastMessageTime, 'YYYY-mm-dd') }}
{{ formatPast(item.lastMessageTime, 'YYYY-MM-DD') }}
</span>
</div>
<!-- 最后聊天内容 -->