Skip to content

Commit a24895d

Browse files
committed
fix: refactor uptime display to use timeEn2Zh function for better readability
1 parent f0f955e commit a24895d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

app/info/(Info)/mobile/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export default function Mobile() {
5050
<p>前端版本號: {(ping && Object.keys(ping).length !== 0) && "v"}{ping?.Frontend?.currentVersion}</p>
5151
<p>後端版本號: {(ping && Object.keys(ping).length !== 0) && "v"}{ping?.Backend?.currentVersion}</p>
5252
<br />
53-
<p>前端運行時間:{ping?.Frontend?.uptime.replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒")}</p>
54-
<p>後端運行時間:{ping?.Backend?.uptime.replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒")}</p>
53+
<p>前端運行時間:{timeEn2Zh(ping?.Frontend?.uptime)}</p>
54+
<p>後端運行時間:{timeEn2Zh(ping?.Backend?.uptime)}</p>
5555
<br />
5656
<p>訪問<Link href={"https://status.sig.school/"} target="_blank">狀態頁面</Link>獲取更多詳細信息</p>
5757
<p className={styles.endText}><Link href={"https://sig.mingdao.edu.tw/ping"} target="_blank">前端</Link></p>
@@ -65,4 +65,8 @@ export default function Mobile() {
6565
</div>
6666
</div >
6767
);
68+
}
69+
70+
function timeEn2Zh(time: string) {
71+
return time?.replace("month,", "月").replace("months,", "月").replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒").replace("day,", "天").replace("hour,", "時").replace("minute,", "分").replace("second", "秒").replace("month", "月").replace("months", "月").replace("days", "天").replace("hours", "時").replace("minutes", "分").replace("day", "天").replace("hour", "時").replace("minute", "分");
6872
}

0 commit comments

Comments
 (0)