fix: rrule detection
This commit is contained in:
@@ -22,7 +22,7 @@ export function parseCron(cron: string | null): {
|
|||||||
value: 0,
|
value: 0,
|
||||||
date: null,
|
date: null,
|
||||||
};
|
};
|
||||||
} else if (cron.startsWith("RRULE:") || cron.startsWith("DTSTART:")) {
|
} else if (isRrule(cron)) {
|
||||||
return parseRrule(cron);
|
return parseRrule(cron);
|
||||||
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
|
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
|
||||||
return {
|
return {
|
||||||
@@ -75,6 +75,10 @@ export function parseCron(cron: string | null): {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isRrule(cron: string): boolean {
|
||||||
|
return cron.startsWith("RRULE:") || cron.startsWith("DTSTART:");
|
||||||
|
}
|
||||||
|
|
||||||
export function parseRrule(rule: string): {
|
export function parseRrule(rule: string): {
|
||||||
type: CronType;
|
type: CronType;
|
||||||
value: number;
|
value: number;
|
||||||
@@ -193,7 +197,7 @@ export function nextCronReset(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (cron.startsWith("RRULE:")) {
|
if (isRrule(cron)) {
|
||||||
try {
|
try {
|
||||||
const rule = new RRule({
|
const rule = new RRule({
|
||||||
...RRule.parseString(cron),
|
...RRule.parseString(cron),
|
||||||
|
|||||||
Reference in New Issue
Block a user