From a749d48d66f5b1cb24c94a471cb1b74c9fb9683a Mon Sep 17 00:00:00 2001
From: 42inshin <inshin@student.42seoul.kr>
Date: Mon, 1 Jan 2024 00:10:59 +0900
Subject: [PATCH] =?UTF-8?q?[FE]=20FIX:=20=EC=9B=94=EC=84=A0=ED=83=9D=20?=
 =?UTF-8?q?=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EC=95=88=EB=82=98=EC=98=A4?=
 =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95=20#83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/stores/monthlog.ts | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/stores/monthlog.ts b/src/stores/monthlog.ts
index 45a6e71..dcd70a5 100644
--- a/src/stores/monthlog.ts
+++ b/src/stores/monthlog.ts
@@ -150,18 +150,18 @@ export const useMonthLogStore = defineStore("MonthLog", () => {
   // 달력에 보여줄 날짜 계산하기
   const calcOptions = () => {
     const options = [];
-    for (let year = FIRST_DAY.year; year <= showToday().getFullYear(); year++) {
-      if (year == FIRST_DAY.year) {
-        for (let month = FIRST_DAY.month - 1; month < 12; month++) {
-          options.push(`${year}. ${month + 1}`);
-        }
-        continue;
-      } else {
-        for (let month = 0; month <= showToday().getMonth(); month++) {
-          options.push(`${year}. ${month + 1}`);
-        }
+    const currentYear = showToday().getFullYear();
+    const currentMonth = showToday().getMonth();
+
+    for (let year = FIRST_DAY.year; year <= currentYear; year++) {
+      const startMonth = year === FIRST_DAY.year ? FIRST_DAY.month - 1 : 0;
+      const endMonth = year === currentYear ? currentMonth : 11;
+
+      for (let month = startMonth; month <= endMonth; month++) {
+        options.push(`${year}. ${month + 1}`);
       }
     }
+
     return options;
   };