Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9baf427

Browse files
committed
Match next run timezone with from timezone
1 parent1df143d commit9baf427

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎src/Symfony/Component/Scheduler/Tests/Trigger/PeriodicalTriggerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class PeriodicalTriggerTest extends TestCase
2323
*/
2424
publicfunctiontestConstructor(PeriodicalTrigger$trigger,bool$optimizable =true)
2525
{
26-
$run =new \DateTimeImmutable('2922-02-2213:34:00+00:00');
26+
$run =new \DateTimeImmutable('2922-02-2212:34:00+00:00');
2727

28-
$this->assertSame('2922-02-23 13:34:00+00:00',$trigger->getNextRunDate($run)->format('Y-m-d H:i:sP'));
28+
$this->assertSame('2922-02-23 13:34:00+01:00',$trigger->getNextRunDate($run)->format('Y-m-d H:i:sP'));
2929

3030
if ($optimizable) {
3131
// test that we are using the fast algorithm for short period of time
@@ -37,7 +37,7 @@ public function testConstructor(PeriodicalTrigger $trigger, bool $optimizable =
3737

3838
publicstaticfunctionprovideForConstructor():iterable
3939
{
40-
$from =new \DateTimeImmutable($now ='2022-02-22 13:34:00+00:00');
40+
$from =new \DateTimeImmutable($now ='2022-02-22 13:34:00+01:00');
4141
$until =new \DateTimeImmutable($farFuture ='3000-01-01');
4242

4343
yield [newPeriodicalTrigger(86400,$from,$until)];

‎src/Symfony/Component/Scheduler/Trigger/PeriodicalTrigger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getNextRunDate(\DateTimeImmutable $run): ?\DateTimeImmutable
9797
$delta =$run->format('U.u') -$from;
9898
$recurrencesPassed =floor($delta /$this->intervalInSeconds);
9999
$nextRunTimestamp =sprintf('%.6F', ($recurrencesPassed +1) *$this->intervalInSeconds +$from);
100-
$nextRun = \DateTimeImmutable::createFromFormat('U.u',$nextRunTimestamp,$fromDate->getTimezone());
100+
$nextRun = \DateTimeImmutable::createFromFormat('U.u',$nextRunTimestamp)->setTimezone($fromDate->getTimezone());
101101

102102
if ($this->from >$nextRun) {
103103
return$this->from;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp