diff --git a/app/client/modules/backups/components/create-schedule-form.tsx b/app/client/modules/backups/components/create-schedule-form.tsx index 1e6f2edb..1d94ff17 100644 --- a/app/client/modules/backups/components/create-schedule-form.tsx +++ b/app/client/modules/backups/components/create-schedule-form.tsx @@ -83,7 +83,7 @@ const backupScheduleToFormValues = (schedule?: BackupSchedule): InternalFormValu return undefined; } - const cronValues = cronToFormValues(schedule.cronExpression); + const cronValues = cronToFormValues(schedule.cronExpression ?? "0 * * * *"); const patterns = schedule.includePatterns || []; const isGlobPattern = (p: string) => /[*?[\]]/.test(p); diff --git a/app/client/modules/backups/lib/cron-utils.ts b/app/client/modules/backups/lib/cron-utils.ts index a7bcf2f8..71d881ea 100644 --- a/app/client/modules/backups/lib/cron-utils.ts +++ b/app/client/modules/backups/lib/cron-utils.ts @@ -77,6 +77,10 @@ const matchers: Matcher[] = [ ]; export const cronToFormValues = (cronExpression: string): CronFormValues => { + if (!cronExpression) { + return { frequency: "hourly" }; + } + const normalized = cronExpression.trim().replace(/\s+/g, " "); const parts = normalized.split(" ");