-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5983141
fix: use the server timezone to parse the cron expression
jonnochoo 0d72715
feat: added configuration for timezone
jonnochoo 4f0b668
chore: remove debug line
jonnochoo 29ffdf5
feat: improve UI to show the timezone
jonnochoo dac9295
Merge pull request #1 from jonnochoo/feat/config
jonnochoo c7986d2
chore: fix whitespace
jonnochoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
{{define "base"}} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{{navbarTitle}}</title> | ||
<script> | ||
function getConfig() { | ||
return { | ||
apiURL: "{{ apiURL }}", | ||
title: "{{ navbarTitle }}", | ||
navbarColor: "{{ navbarColor }}", | ||
version: "{{ version }}", | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>{{ navbarTitle }}</title> | ||
<script> | ||
function getConfig() { | ||
return { | ||
apiURL: "{{ apiURL }}", | ||
title: "{{ navbarTitle }}", | ||
navbarColor: "{{ navbarColor }}", | ||
version: "{{ version }}", | ||
timeZone: "{{ timeZone }}", | ||
}; | ||
} | ||
} | ||
</script> | ||
<script defer="defer" src="/assets/bundle.js?v={{ version }}"></script> | ||
</head> | ||
<body> | ||
{{template "content" .}} | ||
</body> | ||
|
||
</script> | ||
<script defer="defer" src="/assets/bundle.js?v={{ version }}"></script> | ||
</head> | ||
<body> | ||
{{template "content" .}} | ||
</body> | ||
</html> | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
title: '', | ||
navbarColor: '', | ||
version: '', | ||
timeZone: '', | ||
}; | ||
} | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,9 +150,16 @@ export function getNextSchedule(data: WorkflowListItem): number { | |
if (!schedules || schedules.length == 0 || data.Suspended) { | ||
return Number.MAX_SAFE_INTEGER; | ||
} | ||
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 commentThe 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. |
||
const datesToRun = schedules.map((s) => { | ||
const expression = tz | ||
? cronParser.parseExpression(s.Expression, { | ||
currentDate: new Date(), | ||
tz, | ||
}) | ||
: cronParser.parseExpression(s.Expression); | ||
return expression.next(); | ||
}); | ||
const sorted = datesToRun.sort((a, b) => a.getTime() - b.getTime()); | ||
return sorted[0].getTime() / 1000; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?