Skip to content

Fix timezone conversion for stepped cron expressions#60870

Closed
egknight wants to merge 1 commit into
laravel:13.xfrom
egknight:agent/convert-stepped-cron-timezones
Closed

Fix timezone conversion for stepped cron expressions#60870
egknight wants to merge 1 commit into
laravel:13.xfrom
egknight:agent/convert-stepped-cron-timezones

Conversation

@egknight

Copy link
Copy Markdown

Summary

  • Expand stepped cron hour fields before applying timezone offsets.
  • Preserve the existing carry-aware grouping when converted values cross midnight.
  • Add coverage for everyFourHours() during British Summer Time and update the existing stepped-hour cases.

Background

schedule:list currently passes stepped fields such as */4 and 1-23/2 through timezone conversion unchanged. This changes the real execution times when the event timezone differs from the display timezone.

For example, 0 */4 * * * in Europe/London during British Summer Time should be represented in UTC as:

0 23 * * *
0 3,7,11,15,19 * * *

Instead, it is currently returned as 0 */4 * * *. Consumers of the JSON schedule can therefore invoke the scheduler at the wrong UTC hours, after which Laravel's timezone-aware due check rejects the event.

This change expands supported numeric step syntax into explicit values before passing those values through the converter's existing offset and carry logic. Plain numeric fields retain their current behavior, while unsupported cron syntax continues to pass through unchanged.

Tests

  • vendor/bin/phpunit tests/Integration/Console/Scheduling/ScheduleListCommandTest.php
  • vendor/bin/pint src/Illuminate/Console/Scheduling/CronExpressionTimezoneConverter.php tests/Integration/Console/Scheduling/ScheduleListCommandTest.php

@xiCO2k

xiCO2k commented Jul 24, 2026

Copy link
Copy Markdown
Member

Hey @egknight we did this PR covering a bit more edge cases: #60877

can you take a look if works for your case?

Thanks.

@xiCO2k xiCO2k closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants