fix: worksheet 展示时间修改

This commit is contained in:
R524809
2026-06-15 16:40:20 +08:00
parent 0bcf846857
commit b802709517
5 changed files with 20 additions and 7 deletions
+8 -3
View File
@@ -82,6 +82,13 @@ function debugLogWorksheetStatsAfterCategoryLoad(
// --- 调试块结束 ---
function toContentDate(raw: Record<string, any>): string {
const ts = raw.contentUpdatedAt || raw.createdAt;
return ts
? new Date(ts).toISOString().slice(0, 10)
: new Date().toISOString().slice(0, 10);
}
/** 将云端 worksheet 原始数据转换为 CategoryItem */
function toDisplayItem(raw: Record<string, any>): CategoryItem {
const difficulty = (Number(raw.difficulty) || 2) as 1 | 2 | 3 | 4;
@@ -101,9 +108,7 @@ function toDisplayItem(raw: Record<string, any>): CategoryItem {
available: true,
likes: Number(raw.likes) || 0,
downloads: Number(raw.downloads) || 0,
date: raw.updatedAt
? new Date(raw.updatedAt).toISOString().slice(0, 10)
: new Date().toISOString().slice(0, 10),
date: toContentDate(raw),
updatedAt: raw.updatedAt ? String(raw.updatedAt) : '',
};
}