添加动图支持,优化图片和视频上传逻辑,调整超时设置,增强评论时间格式化

This commit is contained in:
2025-10-23 00:58:56 +08:00
parent fe9bc8fd6c
commit 77bc2c5775
15 changed files with 82 additions and 31 deletions
+13
View File
@@ -70,3 +70,16 @@ export function saveToStorage(key: string, value: string | number): void {
if (typeof window === "undefined") return;
localStorage.setItem(key, value.toString());
}
// 稳定的绝对时间格式(与 locale 无关),用于避免 SSR/CSR 水合不一致
// 输出示例:2025-10-20 08:23:05 UTC
export function formatAbsoluteUTC(date: string | Date): string {
const d = new Date(date);
const Y = d.getUTCFullYear();
const M = String(d.getUTCMonth() + 1).padStart(2, "0");
const D = String(d.getUTCDate()).padStart(2, "0");
const h = String(d.getUTCHours()).padStart(2, "0");
const m = String(d.getUTCMinutes()).padStart(2, "0");
const s = String(d.getUTCSeconds()).padStart(2, "0");
return `${Y}-${M}-${D} ${h}:${m}:${s} UTC`;
}