🎨 优化输出

This commit is contained in:
BTMuli
2025-09-04 18:30:30 +08:00
parent 25dcb86818
commit 897fdc3b12

View File

@@ -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")}`;
}