Closed Naghal closed 1 year ago
Hello,
I'm so sorry for the delay, It's not the indented behavior, it's a bug and not yet clear to me. I will work on this.
Meanwhile if it helps, I noted that it does not happen using the enable()
:
BusinessTime::enable(Carbon::class, [
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
]);
$c = Carbon::parse('2022-10-21 06:40:00');
echo $c->subOpenHours(1);
It should now be fixed in 1.11.3
Thanks for the report 🙏
Hi!
Context I have the following use case: When a ticket is assigned in a new section, I want to recalculate its new service level agreement. Sometime, because the grace period of the new section is shorter than the grace period of the previous ticket, I need to remove open hours instead of adding hours. I saw that there is a method for that
subOpenHours
.Error Unfortunately, using local mode with, it throws the exception
InvalidArgumentException
with the messageOpening hours have not been set.
.I have tried
addOpenHours (-1)
,subOpenHours(1)
andsubOpenHours(-1)
, they all throw the exception.This might be related to https://github.com/kylekatarnls/business-time/issues/31
Code reproduce:
Is this the intended behaviour or maybe this is a bug?