fix: variable name
This commit is contained in:
@@ -7,8 +7,8 @@ export const formatDuration = (startTime?: string, endTime?: string) => {
|
|||||||
if (!startTime || !endTime) return '';
|
if (!startTime || !endTime) return '';
|
||||||
const start = dayjs(startTime);
|
const start = dayjs(startTime);
|
||||||
const end = dayjs(endTime);
|
const end = dayjs(endTime);
|
||||||
const diffMillis = end.diff(start, 'second');
|
const diffSeconds = end.diff(start, 'second');
|
||||||
const duration = dayjs.duration(Math.abs(diffMillis), 'second');
|
const duration = dayjs.duration(Math.abs(diffSeconds), 'second');
|
||||||
const d = Math.floor(duration.asDays());
|
const d = Math.floor(duration.asDays());
|
||||||
const h = duration.hours();
|
const h = duration.hours();
|
||||||
const m = duration.minutes();
|
const m = duration.minutes();
|
||||||
@@ -18,5 +18,5 @@ export const formatDuration = (startTime?: string, endTime?: string) => {
|
|||||||
if (h > 0) result += `${h}小时`;
|
if (h > 0) result += `${h}小时`;
|
||||||
if (m > 0) result += `${m}分钟`;
|
if (m > 0) result += `${m}分钟`;
|
||||||
if (s > 0) result += `${s}秒`;
|
if (s > 0) result += `${s}秒`;
|
||||||
return diffMillis < 0 ? `-${result}` : result;
|
return diffSeconds < 0 ? `-${result}` : result;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user