fix(frontend): parse cron scheduled session times as UTC#1496
Conversation
cron-parser defaults to the local timezone, causing the "Next 3 runs" preview to show incorrect UTC times for users outside UTC. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe cron parser in ChangesCron Timezone Configuration
🚥 Pre-merge checks | ✅ 8✅ Passed checks (8 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/cc @jsell-rh |
|
@machadovilaca Nice catch, thank you! Do you think it would be better to consistently show times in the browser's timezone? Including making the cron expression entry assume browser's TZ. Especially for the folks that aren't +/- 1 UTC, the offset calculation can be a point of friction. It would require a bit of transformation to take the hour from the cron entry on the frontend so that the user inputs in their local TZ and the API call uses UTC, but it might be a nice quality of life improvement. What do you think? |
@jsell-rh i think that makes sense basically would become should this be done as part of this PR, or in a follow-up? |
|
@machadovilaca, that looks good to me. I'll approve this workflow to run, and kindly ask that you open a follow-up with the local TZ changes. Thank you! |
Add getCronDescriptionWithLocal() that enriches cron descriptions with the user's local timezone. "At 05:30 AM, Monday through Friday" becomes "At 05:30 AM UTC, Monday through Friday (6:30 AM GMT+1)". Sub-daily schedules (every hour, every 15 min) skip the annotation since the local offset adds no value. Applied consistently across: - Scheduled sessions list (Schedule column) - Scheduled session detail card - Create/edit form preview Follows up on ambient-code#1496 which fixed cron parsing to use UTC. We chose UTC input with local display (rather than local-first input) to avoid DST drift, fractional offset conversion bugs, and day-of-week wrapping edge cases documented in the design spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add getCronDescriptionWithLocal() that enriches cron descriptions with the user's local timezone. "At 05:30 AM, Monday through Friday" becomes "At 05:30 AM UTC, Monday through Friday (6:30 AM GMT+1)". Sub-daily schedules (every hour, every 15 min) skip the annotation since the local offset adds no value. Applied consistently across: - Scheduled sessions list (Schedule column) - Scheduled session detail card - Create/edit form preview Follows up on ambient-code#1496 which fixed cron parsing to use UTC. We chose UTC input with local display (rather than local-first input) to avoid DST drift, fractional offset conversion bugs, and day-of-week wrapping edge cases documented in the design spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add getCronDescriptionWithLocal() that enriches cron descriptions with the user's local timezone. "At 05:30 AM, Monday through Friday" becomes "At 05:30 AM UTC, Monday through Friday (6:30 AM GMT+1)". Sub-daily schedules (every hour, every 15 min) skip the annotation since the local offset adds no value. Applied consistently across: - Scheduled sessions list (Schedule column) - Scheduled session detail card - Create/edit form preview Follows up on ambient-code#1496 which fixed cron parsing to use UTC. We chose UTC input with local display (rather than local-first input) to avoid DST drift, fractional offset conversion bugs, and day-of-week wrapping edge cases documented in the design spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cron-parser defaults to the browser's local timezone, so "Next 3 runs" shows times offset from UTC even though the cron expression is stored and executed as UTC
shows 7:30 AM UTC (8:30 AM GMT+1) for next run
shows a different time: At 08:30 AM UTC
Fixed by passing { tz: "UTC" } to CronExpressionParser.parse() so next run calculations match UTC
Summary by CodeRabbit