Skip to content

Commit 2784ca1

Browse files
authored
fix hours and minutes extraction in scheduler dailyAt() method (#56308)
1 parent 21f12d8 commit 2784ca1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Illuminate/Console/Scheduling/ManagesFrequencies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public function dailyAt($time)
345345
$segments = explode(':', $time);
346346

347347
return $this->hourBasedSchedule(
348-
count($segments) === 2 ? (int) $segments[1] : '0',
348+
count($segments) >= 2 ? (int) $segments[1] : '0',
349349
(int) $segments[0]
350350
);
351351
}

tests/Console/Scheduling/FrequencyTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public function testDailyAt()
4848
$this->assertSame('8 13 * * *', $this->event->dailyAt('13:08')->getExpression());
4949
}
5050

51+
public function testDailyAtParsesMinutesAndIgnoresSecondsWhenSecondsAreDefined()
52+
{
53+
$this->assertSame('8 13 * * *', $this->event->dailyAt('13:08:10')->getExpression());
54+
}
55+
5156
public function testTwiceDaily()
5257
{
5358
$this->assertSame('0 3,15 * * *', $this->event->twiceDaily(3, 15)->getExpression());

0 commit comments

Comments
 (0)