Skip to content

Commit 2a6633b

Browse files
committed
[fix] 시간 파싱 애러 수정
1 parent 68845ed commit 2a6633b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/nambang_swag/bada_on/service/WeatherService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public WeatherDetail getWeatherDetail(Long placeId, int date, int hour) {
7070
Place place = placeRepository.findById(placeId).orElseThrow(PlaceNotFound::new);
7171
Weather weather = weatherRepository.findByDateAndTimeAndPlace(date, hour * 100, place)
7272
.orElseThrow(WeatherNotFound::new);
73-
73+
7474
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
7575
LocalDateTime requestTime = toLocalDateTime(date, hour);
7676
int first = Integer.parseInt(requestTime.minusDays(1).format(formatter));
@@ -623,11 +623,11 @@ private TideInfo findClosestNextTideRecord(List<TideRecord> tideRecords, LocalDa
623623
private LocalDateTime toLocalDateTime(int date, int hour) {
624624
String dateTimeString = "";
625625
if (hour == 0) {
626-
dateTimeString = String.format("%08d0000", date);
626+
dateTimeString = String.format("%08d00", date);
627627
} else {
628628
dateTimeString = String.format("%08d%02d", date, hour);
629629
}
630-
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
630+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHH");
631631
return LocalDateTime.parse(dateTimeString, formatter);
632632
}
633633
}

0 commit comments

Comments
 (0)