Context module for managing library holidays and weekly schedules for business day calculations.
This module provides functions to:
- Manage holidays (specific dates like Christmas, Independence Day)
- Configure weekly schedules (which days of the week are business days)
- Calculate business days excluding configured non-business days and holidays
- Import common holidays
- Validate holiday and schedule configurations
The system supports two types of entries:
schedule_type: "holiday"- Specific holiday datesschedule_type: "schedule"- Weekly recurring schedule patterns
This unified approach allows flexible customization of:
- Which days of the week are business days (not just Mon-Fri)
- Specific holiday dates that override normal schedule
- Different types of holidays (public, library, custom)
Summary
Functions
Add business days to a date, skipping weekends and holidays.
Calculate business days between two dates, excluding weekends and holidays.
Returns an %Ecto.Changeset{} for tracking holiday changes.
Creates a holiday.
Creates a new schedule configuration.
Deletes a holiday.
Deletes a schedule configuration.
Get business days for the current week.
Get schedule configuration for a specific day of week.
Gets a single holiday.
Get holiday statistics for reporting.
Get all holidays within a date range.
Get non-business days for the current week.
Get upcoming holidays for the next N days.
Get the current weekly schedule configuration.
Check if library operates on a specific day of week based on schedule.
Check if a given date is a holiday (weekend or custom holiday).
Check if a given date is a weekend.
Returns the list of all holidays.
Returns the list of holidays with pagination.
Returns the list of weekly schedule configurations.
Calculate the next business day from a given date.
Set up default weekly schedule (Monday-Friday business, Saturday-Sunday non-business).
Update a specific day's business status in the weekly schedule.
Updates a holiday.
Updates a schedule configuration.
Functions
Add business days to a date, skipping weekends and holidays.
Calculate business days between two dates, excluding weekends and holidays.
Returns an %Ecto.Changeset{} for tracking holiday changes.
Creates a holiday.
Creates a new schedule configuration.
Deletes a holiday.
Deletes a schedule configuration.
Get business days for the current week.
Get schedule configuration for a specific day of week.
Gets a single holiday.
Get holiday statistics for reporting.
Get all holidays within a date range.
Get non-business days for the current week.
Get upcoming holidays for the next N days.
Get the current weekly schedule configuration.
Check if library operates on a specific day of week based on schedule.
Check if a given date is a holiday (weekend or custom holiday).
Check if a given date is a weekend.
Returns the list of all holidays.
Returns the list of holidays with pagination.
Returns the list of weekly schedule configurations.
Calculate the next business day from a given date.
Set up default weekly schedule (Monday-Friday business, Saturday-Sunday non-business).
Update a specific day's business status in the weekly schedule.
Updates a holiday.
Updates a schedule configuration.