diff --git a/packages/loot-core/src/server/budget/goaltemplates.ts b/packages/loot-core/src/server/budget/goaltemplates.ts index d7bb126ebc150a9a77155302d85b70418986e2c0..fef46900f785e0e0149bdc4be647967c8a7b2760 100644 --- a/packages/loot-core/src/server/budget/goaltemplates.ts +++ b/packages/loot-core/src/server/budget/goaltemplates.ts @@ -533,11 +533,31 @@ async function applyCategoryTemplate( dateCond, monthUtils._parse(current_month), ); + + let isRepeating = + Object(dateCond.value) === dateCond.value && + 'frequency' in dateCond.value; + let num_months = monthUtils.differenceInCalendarMonths( next_date_string, current_month, ); + if (isRepeating) { + let monthlyTarget = 0; + let next_month = monthUtils.addMonths(current_month, num_months + 1); + let next_date = getNextDate( + dateCond, + monthUtils._parse(current_month), + ); + while (next_date < next_month) { + monthlyTarget += amountCond.value; + next_date = monthUtils.addDays(next_date, 1); + next_date = getNextDate(dateCond, monthUtils._parse(next_date)); + } + amountCond.value = monthlyTarget; + } + if (template.full === true) { if (num_months === 1) { to_budget = -getScheduledAmount(amountCond.value); diff --git a/upcoming-release-notes/1193.md b/upcoming-release-notes/1193.md new file mode 100644 index 0000000000000000000000000000000000000000..b8c9268cc59dde5ef9297078e05320659e967de3 --- /dev/null +++ b/upcoming-release-notes/1193.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [shall0pass] +--- + +Goals: Schedule keyword supports daily or weekly recurring schedules