feat: add end support for calc-schedule-budget
parent
3636531a18
commit
b7227b50f4
|
|
@ -41,16 +41,24 @@ for (const s of schedules) {
|
|||
}
|
||||
|
||||
const start = (typeof s._date === 'string' ? s._date : s._date.start).slice(0, 7);
|
||||
// TODO: get end
|
||||
if (start > month) {
|
||||
console.log(chalk.grey(`- ${formatSchedule(s)}: not in range`));
|
||||
continue;
|
||||
}
|
||||
|
||||
let date = start;
|
||||
while (date < month) {
|
||||
date = addFromFrequency(date, s._date.frequency, s._date.interval);
|
||||
if (s.name === "Etails - Téléphone" || s.name === "FF14") {
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
let date = start;
|
||||
if (typeof s._date === 'object') {
|
||||
let occurrences = 0;
|
||||
while (date < month || occurrences < s._date.endOccurrences) {
|
||||
occurrences += 1;
|
||||
date = addFromFrequency(date, s._date.frequency, s._date.interval);
|
||||
}
|
||||
}
|
||||
|
||||
if (date !== month) {
|
||||
console.log(chalk.grey(`- ${formatSchedule(s)}: not the specified month`));
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue