Update app/utils/utils.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
47aefa9bcb
commit
e350843d4e
1 changed files with 4 additions and 1 deletions
|
|
@ -16,7 +16,10 @@ export const getCronExpression = (frequency: string, dailyTime?: string, weeklyD
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frequency === "monthly") {
|
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";
|
const days = sortedDays.length > 0 ? sortedDays.join(",") : "1";
|
||||||
return `${minutes} ${hours} ${days} * *`;
|
return `${minutes} ${hours} ${days} * *`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue