mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-26 05:39:45 +08:00
🎨 优化输出
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file utils/toolFunc.ts
|
||||
* @description 一些工具函数
|
||||
* @since Beta v0.7.9
|
||||
* @since Beta v0.8.0
|
||||
*/
|
||||
|
||||
import { AvatarExtResTypeEnum, AvatarExtTypeEnum } from "@enum/bbs.js";
|
||||
@@ -16,15 +16,16 @@ import { AppCharacterData, AppWeaponData } from "@/data/index.js";
|
||||
|
||||
/**
|
||||
* @description 时间戳转换为时间字符串
|
||||
* @since Beta v0.8.0
|
||||
* @param {number} time - 时间戳(毫秒)
|
||||
* @returns {string} 时间字符串 d天 hh:mm:ss
|
||||
* @param time
|
||||
*/
|
||||
export function stamp2LastTime(time: number): string {
|
||||
const day = Math.floor(time / (24 * 3600 * 1000));
|
||||
const hour = Math.floor((time % (24 * 3600 * 1000)) / (3600 * 1000));
|
||||
const minute = Math.floor((time % (3600 * 1000)) / (60 * 1000));
|
||||
const second = Math.floor((time % (60 * 1000)) / 1000);
|
||||
return `${day === 0 ? "" : `${day}天`} ${hour.toFixed(0).padStart(2, "0")}:${minute
|
||||
return `${day === 0 ? "" : `${day}天 `}${hour.toFixed(0).padStart(2, "0")}:${minute
|
||||
.toFixed(0)
|
||||
.padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user