SWM-99-degree / jariBean

SWM 14th JariBean Project
0 stars 1 forks source link

Refact208 #213

Closed psy-choi closed 11 months ago

psy-choi commented 11 months ago

성공

LocalDateTime startTime =cafe.getStartTime().withDayOfMonth(localDateTime.getDayOfMonth()).withMonth(localDateTime.getMonthValue()).withYear(localDateTime.getYear());

LocalDateTime endTime =cafe.getEndTime().withDayOfMonth(localDateTime.getDayOfMonth()).withMonth(localDateTime.getMonthValue()).withYear(localDateTime.getYear());

=>

LocalDateTime startTime =cafe.getStartTime().withMonth(localDateTime.getMonthValue()).withDayOfMonth(localDateTime.getDayOfMonth()).withYear(localDateTime.getYear());

LocalDateTime endTime =cafe.getEndTime().withMonth(localDateTime.getMonthValue()).withDayOfMonth(localDateTime.getDayOfMonth()).withYear(localDateTime.getYear());

실제로 데이터 적제가 9월 15일로 되어있었는데, 기존의 코드는 '날'부터 바꾸는 형식이었다. 즉, 9월 15일에서 31일로 바꾸는 형식으로 했으니 실제로 오류가 발생할수 밖에 없는 코드였다. 간단하게 설명하면 9월 15일 -> 9월 31일 -> 10월 31일의 과정을 거치게 된다. 그렇기 때문에 '월'부터 변경하는 코드가 우선적으로 진행되어서 9월 15일 -> 10월 15일 -> 10월 31일 로 변경하는 로직으로 구성되게 하였다.