Skip to content

Commit

Permalink
[BE] FIX: 등록 가능 날짜 조회 시 해당 월의 첫 날 자정으로 수정
Browse files Browse the repository at this point in the history
기존 시간설정을 하지 않아 조회 당일 기준보다 이전의 폼을 반환하지 않는 오류 수정
  • Loading branch information
saewoo1 committed Oct 11, 2024
1 parent 52648ad commit d5dc781
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@Transactional(readOnly = true)
public class PresentationService {

private static final Integer START_DAY = 1;
private static final Integer PRESENTATION_PERIOD = 3;
private static final Integer DEFAULT_PAGE = 0;
// 쿼리로 받?
private static final Integer MAX_MONTH = 3;
Expand Down Expand Up @@ -285,9 +285,10 @@ public void generatePresentationFormsEveryThreeMonth(LocalDate nowDate) {
}

public AbleDateResponseDto getAbleDate() {
LocalDateTime now = LocalDateTime.now();
LocalDateTime firstDateOfMonth = generateFirstLocalDateTime();
List<Presentation> dummyDates =
presentationQueryService.getDummyDateBetweenMonth(now, now.plusMonths(3));
presentationQueryService.getDummyDateBetweenMonth(firstDateOfMonth,
firstDateOfMonth.plusMonths(PRESENTATION_PERIOD));

List<LocalDateTime> result =
dummyDates.stream()
Expand All @@ -296,4 +297,12 @@ public AbleDateResponseDto getAbleDate() {

return new AbleDateResponseDto(result);
}

private LocalDateTime generateFirstLocalDateTime() {
return LocalDateTime.now()
.withDayOfMonth(1)
.withHour(0)
.withMinute(0)
.withSecond(0);
}
}

0 comments on commit d5dc781

Please sign in to comment.