chore: Modify the default runtime value on the overview page (#11159)

This commit is contained in:
ssongliu 2025-12-02 18:21:42 +08:00 committed by GitHub
parent 28303ffa82
commit ba999c516a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,11 +57,14 @@ export function getBrowserLang() {
}
export function loadUpTime(timeSince: string) {
if (!timeSince) {
return '';
}
const targetTime = new Date(timeSince);
const currentTime = new Date();
const uptime = (currentTime.getTime() - targetTime.getTime()) / 1000;
if (uptime <= 0) {
return '-';
return '';
}
let days = Math.floor(uptime / 86400);
let hours = Math.floor((uptime % 86400) / 3600);