All packages
Opening Hours for Laravel
Spans and durations
Span queries work on coalesced periods clipped to the span:
$hours->openingPeriodsBetween($monday, $monday->addWeek()); // list<OpeningPeriod>, clipped
$hours->isOpenDuring($from, $to); // open for the whole span
$hours->isClosedDuring($from, $to); // not open at any moment
$hours->openSecondsBetween($monday, $monday->addWeek()); // real elapsed seconds
$hours->closedSecondsBetween($from, $to);
$hours->openDurationBetween($from, $to); // CarbonInterval- isOpenDuring() is true only when one continuous run covers the whole span; isClosedDuring() is true when no moment of it is open.
- Durations are real elapsed time — a 00:00–24:00 day lasts 23 or 25 hours on clock-change days.
- openDurationBetween() returns a cascaded CarbonInterval.
- Spans longer than max_query_days throw QueryRangeTooLargeException, carrying requestedDays and maxDays.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.