From bfa3956e965f660f7c65dba8078f10afd70c53b5 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 28 Oct 2024 17:36:51 +0100 Subject: [PATCH] Update README.md Add a note about always open/closed shcedules --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aa0e623..04d8eec 100644 --- a/README.md +++ b/README.md @@ -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` @@ -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')); ```