diff --git a/apps/web/lib/version-plan.ts b/apps/web/lib/version-plan.ts index 0891620..59ee789 100644 --- a/apps/web/lib/version-plan.ts +++ b/apps/web/lib/version-plan.ts @@ -55,9 +55,10 @@ export function calcPlanDuration(start: string, end: string): { days: number; ho } export function formatDuration(days: number, hours: number): string { - if (hours > 0) return `${hours}h`; - if (days === 0) return '0天'; - return `${days}天`; + if (hours <= 0) return '0h'; + if (hours < 24) return `${hours}h`; + if (hours % 24 === 0) return `${hours / 24}天`; + return `${hours}h`; } export function calcTotalDuration(plans: VersionPlan[]): string {