Skip to content

Commit 5410c21

Browse files
authored
fix(app): only call a cron every N hours when it covers the whole day (#66900)
1 parent f5683d1 commit 5410c21

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎packages/app/src/automations/format.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,20 @@ function describeCron(cron: string, language: Language) {
5555
if (hours.length) {
5656
const step = hours[1]! - hours[0]!
5757

58+
// Evenly spaced across the whole day; `0 9-17 * * *` keeps its cron text.
5859
if (
5960
minutes.length !== 1 ||
6061
hours.length < 2 ||
61-
24 % step ||
62+
hours.length * step !== 24 ||
6263
!hours.every((hour, index) => hour === hours[0]! + index * step)
6364
)
6465
return
6566

66-
return language.t("automations.trigger.hours", { count: step, minute: String(minutes[0]).padStart(2, "0") })
67+
const minute = String(minutes[0]).padStart(2, "0")
68+
69+
if (step === 1) return language.t("automations.trigger.hourly", { minute })
70+
71+
return language.t("automations.trigger.hours", { count: step, minute })
6772
}
6873

6974
if (minutes.length === 1)

0 commit comments

Comments
 (0)