-
Notifications
You must be signed in to change notification settings - Fork 156
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
fix: use the server timezone to parse the cron expression #696
Conversation
Hi @jonnochoo, thank you for draft PR! This looks amazing. Yes, this does need to be fixed. I would suggest adding a new configuration key, dagu/internal/frontend/templates/base.gohtml Lines 10 to 19 in 22fe495
dagu/internal/frontend/server/templates.go Lines 62 to 84 in 22fe495
|
const datesToRun = schedules.map((s) => | ||
cronParser.parseExpression(s.Expression).next() | ||
); | ||
const tz = getConfig().timeZone; |
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.
For backwards compatibility tz won't be set, so it should defer to the original behaviour.
@@ -251,7 +251,9 @@ const defaultColumns = [ | |||
}), | |||
columnHelper.accessor('Type', { | |||
id: 'Schedule', | |||
header: 'Schedule', | |||
header: getConfig().timeZone |
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.
It might be helpful to see what timezone the server is running in?
Thanks for the pointers, I have made the change and you can see in the screenshot it works. The server time it UTC but the client/browser is in Sydney time, and the cron expression shows the correct next run |
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.
LGTM ✨✨✨🚀🚀🚀✨✨✨ Thank you very much for the amazing work!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #696 +/- ##
==========================================
- Coverage 64.08% 62.10% -1.98%
==========================================
Files 53 53
Lines 4318 5215 +897
==========================================
+ Hits 2767 3239 +472
- Misses 1298 1723 +425
Partials 253 253
... and 50 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There is an issue if the server is running in a timezone (eg. UTC), but the client's browser timezone is in another timezone (eg. Australia/Sydney), the cron expression incorrectly shows the Next Run incorrectly.
Next Steps
Open on thoughts on the best way to get the server's timezone? Create an API endpoint? Open to feedback