From 40d94141c4c4fdf066692688ef1b3047b985847d Mon Sep 17 00:00:00 2001
From: shall0pass <20625555+shall0pass@users.noreply.github.com>
Date: Mon, 7 Aug 2023 05:26:52 -0500
Subject: [PATCH] [Bug] Goals: Monthly schedule can cause error (#1478)

The 'interval' value from the schedules is not set if the schedule is
monthly. This change will check for a valid number for the interval
value and if it does not exist will default to 1 (monthly).
---
 packages/loot-core/src/server/budget/goaltemplates.ts | 4 +++-
 upcoming-release-notes/1478.md                        | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 upcoming-release-notes/1478.md

diff --git a/packages/loot-core/src/server/budget/goaltemplates.ts b/packages/loot-core/src/server/budget/goaltemplates.ts
index 975bd2be6..993c30d70 100644
--- a/packages/loot-core/src/server/budget/goaltemplates.ts
+++ b/packages/loot-core/src/server/budget/goaltemplates.ts
@@ -649,7 +649,9 @@ async function applyCategoryTemplate(
               dateConditions,
               monthUtils._parse(current_month),
             );
-            let target_interval = dateConditions.value.interval;
+            let target_interval = dateConditions.value.interval
+              ? dateConditions.value.interval
+              : 1;
             let target_frequency = dateConditions.value.frequency;
             let isRepeating =
               Object(dateConditions.value) === dateConditions.value &&
diff --git a/upcoming-release-notes/1478.md b/upcoming-release-notes/1478.md
new file mode 100644
index 000000000..84c4bf795
--- /dev/null
+++ b/upcoming-release-notes/1478.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [shall0pass]
+---
+
+Goals: Fix error that can occur with monthly schedules
-- 
GitLab