diff --git a/apps/web/app/versions/[id]/page.tsx b/apps/web/app/versions/[id]/page.tsx index 6310050..575b155 100644 --- a/apps/web/app/versions/[id]/page.tsx +++ b/apps/web/app/versions/[id]/page.tsx @@ -396,7 +396,7 @@ export default function VersionDetailPage() { }); vDTs.forEach((t) => { if (t.startDate) startDates.push(t.startDate); }); vTCsAll.forEach((c) => { if (c.startedAt) startDates.push(c.startedAt); }); - const actualStart = startDates.length > 0 ? startDates.sort()[0].slice(0, 10) : (version.startDate ?? null); + const actualStart = startDates.length > 0 ? startDates.sort()[0].slice(0, 16).replace('T', ' ') : (version.startDate ?? null); // 实际截止日期 const endDates: string[] = []; @@ -404,15 +404,19 @@ export default function VersionDetailPage() { vDTs.forEach((t) => { if (t.completedAt) endDates.push(t.completedAt); }); vTCsAll.forEach((c) => { if (c.completedAt) endDates.push(c.completedAt); }); vBugsAll.forEach((b) => { if (b.closedAt) endDates.push(b.closedAt); }); - const actualEnd = endDates.length > 0 ? endDates.sort().reverse()[0].slice(0, 10) : null; + const actualEnd = endDates.length > 0 ? endDates.sort().reverse()[0].slice(0, 16).replace('T', ' ') : null; // 逾期天数 const deadline = version.expectedReleaseDate; let overdueDays = 0; if (deadline && actualEnd) { - overdueDays = Math.floor((new Date(actualEnd).getTime() - new Date(deadline).getTime()) / (1000 * 60 * 60 * 24)); + overdueDays = Math.floor((new Date(actualEnd.replace(' ', 'T')).getTime() - new Date(deadline).getTime()) / (1000 * 60 * 60 * 24)); } + // 总耗时 = 日历天数 + 加班时长 + const versionOTForTime = records.filter((r) => r.versionId === version.id); + const otHoursTotal = Math.round(versionOTForTime.reduce((sum, r) => sum + r.duration, 0) * 10) / 10; + return (
@@ -436,6 +440,9 @@ export default function VersionDetailPage() {
已耗时 {elapsedDays} 天 + {otHoursTotal > 0 && ( + (含加班 {otHoursTotal}h + )}
);