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:
parent
1497a81cd5
commit
64eeaadd28
2 changed files with 11 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue