Skip to content

feat: Support cross-midnight working hours and appointments#1833

Open
gabor-h wants to merge 1 commit into
alextselegidis:developfrom
gabor-h:feature/cross-midnight-appointments
Open

feat: Support cross-midnight working hours and appointments#1833
gabor-h wants to merge 1 commit into
alextselegidis:developfrom
gabor-h:feature/cross-midnight-appointments

Conversation

@gabor-h

@gabor-h gabor-h commented Jan 13, 2026

Copy link
Copy Markdown

Summary

  • Allow working plans with end time before start time (e.g., 18:00-02:00) for businesses operating evening/night shifts
  • Handle breaks within cross-midnight periods correctly (e.g., break at 01:00 when shift starts at 18:00)
  • Split multi-day appointments in calendar views for proper display
  • Remove validation that blocked cross-midnight configurations in working plan exceptions

Details

Calendar displays appointments spanning midnight as two connected blocks (one ending at midnight, one starting at midnight) while storing them as a single appointment in the database.

Files Changed

  • application/libraries/Availability.php - Cross-midnight period calculations
  • application/models/Providers_model.php - Removed start > end validation
  • assets/js/utils/calendar_default_view.js - Split multi-day events for display
  • assets/js/utils/calendar_table_view.js - Split multi-day events for display

Test Plan

  • Configure provider with working hours 20:00-04:00
  • Add break at 01:00-01:30
  • Verify booking page shows correct available hours
  • Book appointment at 23:00 with 2hr duration (ends at 01:00)
  • Verify calendar displays as two connected blocks

Fixes #1432

@alextselegidis

Copy link
Copy Markdown
Owner

Hello!

Thanks for providing this PR.

I will have to take a closer look and write back with more info.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@coryalder

Copy link
Copy Markdown

Any update on this? It'd be lovely to have! :)

@alextselegidis

Copy link
Copy Markdown
Owner

Hello!

There were recent updates in the source that made this PR conflicting.

If possible, please update the solution accordingly.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@gabor-h

gabor-h commented Feb 18, 2026

Copy link
Copy Markdown
Author

I'll look into it in a bit!

Allow working plans with end time before start time (e.g., 18:00-02:00)
for businesses operating evening/night shifts. Key changes:

- Detect cross-midnight periods by checking if end <= start time
- Add +1 day to end times when working hours cross midnight
- Handle breaks within cross-midnight periods correctly (e.g., break at
  01:00 when shift starts at 18:00)
- Split multi-day appointments in calendar views for proper display
- Remove validation that blocked cross-midnight configurations in
  working plan exceptions

Calendar displays appointments spanning midnight as two connected blocks
(one ending at midnight, one starting at midnight) while storing them as
a single appointment in the database.

Fixes alextselegidis#1432

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gabor-h gabor-h force-pushed the feature/cross-midnight-appointments branch from f2241df to d9f2c6a Compare March 28, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants