From 5446337fd6791dece966c4bd16aeeef81372d25b Mon Sep 17 00:00:00 2001 From: mac_daehwan2yo Date: Mon, 11 Apr 2022 21:53:44 +0900 Subject: [PATCH] =?UTF-8?q?fix=20(#4)=20:=20=EC=95=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=EC=A6=98=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0,=20?= =?UTF-8?q?=EB=91=90=20=EB=82=A0=EC=A7=9C=20=EC=82=AC=EC=9D=B4=20dday=20?= =?UTF-8?q?=EA=B5=AC=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/policy/planMaking/MonthPlanMakingPolicy.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/codingwasabi/howtodo/web/policy/planMaking/MonthPlanMakingPolicy.java b/src/main/java/com/codingwasabi/howtodo/web/policy/planMaking/MonthPlanMakingPolicy.java index 6d2c42b..7a5459d 100644 --- a/src/main/java/com/codingwasabi/howtodo/web/policy/planMaking/MonthPlanMakingPolicy.java +++ b/src/main/java/com/codingwasabi/howtodo/web/policy/planMaking/MonthPlanMakingPolicy.java @@ -3,6 +3,7 @@ import static com.codingwasabi.howtodo.web.policy.util.ExamDateSorting.*; import java.time.LocalDate; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -143,13 +144,17 @@ private Map initDailyHours(List exams, LocalDate today LocalDate endDate = exams.get(exams.size() - 1) .getDueDateTime() .toLocalDate(); + int days = getDays(today, endDate); - for (int day = 1; day < today.until(endDate) - .getDays(); day++) { + for (int day = 1; day < days; day++) { nextDay = nextDay.plusDays(1); dailyHours.put(nextDay, 0); } return dailyHours; } + + private int getDays(LocalDate start, LocalDate end) { + return (int)ChronoUnit.DAYS.between(start, end); + } }