|
|
@@ -30,6 +30,7 @@ export const timeConverts = (timestamp: number) => {
|
|
|
if (!timestamp) return "";
|
|
|
let now_timestamp = +new Date();
|
|
|
let diff_timestamp = now_timestamp - timestamp;
|
|
|
+ if (diff_timestamp / 1000 <= 0) return `0秒前`;
|
|
|
if (diff_timestamp / 1000 <= 60) return `${Math.floor(diff_timestamp / 1000)}秒前`;
|
|
|
if (diff_timestamp / 1000 / 60 <= 60) return `${Math.floor((diff_timestamp / 1000) / 60)}分钟前`;
|
|
|
if (diff_timestamp / 1000 / 60 / 60 <= 24) return `${Math.floor(diff_timestamp / 1000 / 60 / 60)}小时前`;
|