Skip to content

Commit

Permalink
fixed bug when using the CRON_TZ= cron expression (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnochoo authored Nov 12, 2024
1 parent 8dc577e commit 855e75d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ui/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ export function getNextSchedule(data: WorkflowListItem): number {
}
const tz = getConfig().tz || moment.tz.guess();
const datesToRun = schedules.map((s) => {
const cronTzMatch = s.Expression.match(/(?<=CRON_TZ=)[^\s]+/);
if (cronTzMatch) {
const cronTz = cronTzMatch[0]
const expressionTextWithOutCronTz = s.Expression.replace(`CRON_TZ=${cronTz}`, '')
return cronParser.parseExpression(expressionTextWithOutCronTz, {
currentDate: new Date(),
tz: cronTz,
}).next()
}
const expression = tz
? cronParser.parseExpression(s.Expression, {
currentDate: new Date(),
Expand Down

0 comments on commit 855e75d

Please sign in to comment.