wujingjing
2025-01-09 04bc71e7d3fb99c95c8771acc65549d553209f24
时间显示错误
已修改1个文件
4 ■■■ 文件已修改
src/components/chat/hooks/useScrollLoad.ts 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/hooks/useScrollLoad.ts
@@ -50,7 +50,9 @@
export const formatShowTimeYear = (str: string) => {
    const date = moment(str);
    const now = moment();
    const diffDays = now.diff(date, 'days');
    // 计算日期差,使用clone()避免修改原始时间
    const diffDays = now.clone().startOf('day').diff(date.clone().startOf('day'), 'days');
    
    if (diffDays === 0) {
        return `今天 ${date.format('HH:mm:ss')}`;