diff --git a/frontend/src/routes/book/+page.svelte b/frontend/src/routes/book/+page.svelte index 7cc75e7..1062f28 100644 --- a/frontend/src/routes/book/+page.svelte +++ b/frontend/src/routes/book/+page.svelte @@ -628,6 +628,22 @@ return allSlots; } + function formatDuration(minutes: number): string { + const hours = Math.floor(minutes / 60); + const remainingMinutes = minutes % 60; + + if (hours === 0) { + return `${remainingMinutes} minutes`; + } else if (remainingMinutes === 0) { + return `${hours} ${hours === 1 ? 'hour' : 'hours'}`; + } else { + return `${hours} ${hours === 1 ? 'hour' : 'hours'} ${remainingMinutes} minutes`; + } + } + + // Use the formatted duration everywhere + const formattedTotalDuration = $derived(formatDuration(getTotalDuration())); + function nextStep() { if (currentStep < 4) { currentStep++; @@ -764,8 +780,8 @@ {/each}
- Total Duration: - {getTotalDuration()} minutes + Estimated Duration: + {formattedTotalDuration}
Total Cost: @@ -787,7 +803,7 @@ Choose Date & Time - {selectedServices.map((s) => s.name).join(', ')} • {getTotalDuration()} minutes total • £{getTotalPrice()} + {selectedServices.map((s) => s.name).join(', ')} • {formattedTotalDuration} total • £{getTotalPrice()} @@ -934,8 +950,8 @@ {selectedTime}
- Total Duration: - {getTotalDuration()} minutes + Estimated Duration: + {formattedTotalDuration}