fix: variable name

This commit is contained in:
yangsy
2025-09-17 11:30:02 +08:00
parent 9b982b7f6c
commit 97b158e807

View File

@@ -7,8 +7,8 @@ export const formatDuration = (startTime?: string, endTime?: string) => {
if (!startTime || !endTime) return '';
const start = dayjs(startTime);
const end = dayjs(endTime);
const diffMillis = end.diff(start, 'second');
const duration = dayjs.duration(Math.abs(diffMillis), 'second');
const diffSeconds = end.diff(start, 'second');
const duration = dayjs.duration(Math.abs(diffSeconds), 'second');
const d = Math.floor(duration.asDays());
const h = duration.hours();
const m = duration.minutes();
@@ -18,5 +18,5 @@ export const formatDuration = (startTime?: string, endTime?: string) => {
if (h > 0) result += `${h}小时`;
if (m > 0) result += `${m}分钟`;
if (s > 0) result += `${s}`;
return diffMillis < 0 ? `-${result}` : result;
return diffSeconds < 0 ? `-${result}` : result;
};