-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.4] Add Event timezone in inTimeInterval $now #19959
Conversation
It's will reduce timezone issue in scheduling, please have a look into this.
Can you add a test for this, please? |
replace strtotime with Carbon parse.
Test case updated for Event timezone in inTimeInterval .
I've updated the test, please have a look into this, Thanks. |
@@ -53,9 +53,11 @@ public function unlessBetween($startTime, $endTime) | |||
private function inTimeInterval($startTime, $endTime) | |||
{ | |||
return function () use ($startTime, $endTime) { | |||
$now = Carbon::now()->getTimestamp(); | |||
$now = Carbon::now($this->timezone)->getTimestamp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just :
return Carbon::now($this->timezone)->between(
Carbon::parse($startTime, $this->timezone),
Carbon::parse($endTime, $this->timezone),
true
);
?
Event time check method replace with carbon between.
Update code style
This changes code unrelated to the timezone. Only make the change specified in the title. |
This fixes the following case:
At I believe this fix is ok. |
Thank you guys 👍 |
It's will reduce timezone issue in scheduling, please have a look into this.