Update app/utils/utils.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Alessandro Zappia
2025-12-19 22:34:19 +01:00
committed by Nico
parent 47aefa9bcb
commit e350843d4e

View File

@@ -16,7 +16,10 @@ export const getCronExpression = (frequency: string, dailyTime?: string, weeklyD
}
if (frequency === "monthly") {
const sortedDays = (monthlyDays || []).map(Number).sort((a, b) => a - b);
const sortedDays = (monthlyDays || [])
.map(Number)
.filter((day) => day >= 1 && day <= 31)
.sort((a, b) => a - b);
const days = sortedDays.length > 0 ? sortedDays.join(",") : "1";
return `${minutes} ${hours} ${days} * *`;
}