Skip to content

Commit

Permalink
보관함에 있는 목표 조회 시 d-day 값을 음수로 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
jemin committed Sep 4, 2023
1 parent 0f2be4c commit 246a9e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/backend/goal/domain/Goal.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public Long calculateDday(final LocalDate now)
{
if(now.isAfter(endDate))
{
return 0L;
ChronoUnit.DAYS.between(endDate, now);
}

return ChronoUnit.DAYS.between(now, endDate);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/backend/goal/domain/GoalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public class GoalTest {
Goal goal = new Goal(1L, "테스트 제목", startDate, endDate, true, GoalStatus.PROCESS);

// when & then
assertThatThrownBy(() -> {
goal.calculateDday(LocalDate.of(2023, 8, 12));
}).isInstanceOf(IllegalArgumentException.class);
Long aLong = goal.calculateDday(LocalDate.of(2023, 8, 11));
System.out.println(aLong);

}

@DisplayName("현재 날짜와 종료 날짜가 같을때 디데이 0을 반환한다.")
Expand Down

0 comments on commit 246a9e1

Please sign in to comment.