Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Add a note about always open/closed shcedules
  • Loading branch information
kylekatarnls authored Oct 28, 2024
1 parent 5a031ad commit bfa3956
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ Set `$cap` to a date so if no open time can be found before this moment, `$cap`
```php
$openingHours->nextOpen(new DateTime('2016-12-24 11:00:00'));
```
`

#### `OpeningHours::nextClose`

Expand All @@ -487,6 +486,11 @@ Set `$searchUntil` to a date to throw an exception if no closed time can be foun

Set `$cap` to a date so if no closed time can be found before this moment, `$cap` is returned.

If the schedule is always open or always closed, there is no state change to found and therefore
`nextOpen` (but also `previousOpen`, `nextClose` and `previousClose`) will throw a `MaximumLimitExceeded`
You can catch it and react accordingly or you can use `isAlwaysOpen` / `isAlwaysClosed` methods
to anticipate such case.

```php
$openingHours->nextClose(new DateTime('2016-12-24 11:00:00'));
```
Expand Down

0 comments on commit bfa3956

Please sign in to comment.