Closed FuriosoJack closed 4 years ago
This feature does not exist now. But I find this interesting, I would have to check how it could be optimized (not looping hour-by-hour) and flexible: also be able subtract, and be able to use any unit: minute, second, or a custom interval.
This feature does not exist now. But I find this interesting, I would have to check how it could be optimized (not looping hour-by-hour) and flexible: also be able subtract, and be able to use any unit: minute, week, or a custom interval.
Excelent, one example in this repository https://github.com/hughgrigg/php-business-time
I won't follow this example, as I said I don't won't to implement it in an non-optimized or non-flexible way. The package you point does not support minutes or custom intervals and it proceeds a loop with as many turns as the given number. This is very slow and consuming with big numbers.
Then, the last problem with this library is it extends directly Carbon so you can't benefit of multiples libraries that do the same (incompatible with Jessengers/Date for instance), the recommended way to add features to Carbon is mixins so you can pick what you want and as many mixins as you want.
If I understand you, you are right
Available in 1.6.0, it takes your holidays and exceptions into account, can handle precise interval (such as "2 hours, 34 minutes and 45seconds" with no degradation of the performances.
Excellent that's a very good feature
It is possible to add hours and to skip closing hours.
that is to say
I have this date which is a Friday for example
08-05-2020 15:00:00
I add 4 hours
but since I have configured the business-time so that from Monday to Friday it is open from 8 AM to 4 PM and on weekends the business does not open
then the departure date should be the following
11-05-2020 11:00:00