Extract weekend detection logic to shared utility

- Created isWeekend() function in utils/date.ts
- Replaced inline weekend detection logic in availability page
- More reusable and testable
This commit is contained in:
counterweight 2025-12-21 17:57:06 +01:00
parent 1497a81cd5
commit 64eeaadd28
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 11 additions and 3 deletions

View file

@ -74,3 +74,11 @@ export function getDateRange(minAdvanceDays: number, maxAdvanceDays: number): Da
return dates;
}
/**
* Check if a date is a weekend (Saturday or Sunday).
*/
export function isWeekend(date: Date): boolean {
const day = date.getDay();
return day === 0 || day === 6;
}