Merge pull request 'fix: toLocalDateTime 변환 강화' (#23) from develop into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 2m29s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 2m29s
This commit is contained in:
커밋
86f0c457e3
@ -228,14 +228,23 @@ public class MonitoringController {
|
||||
return quality;
|
||||
}
|
||||
|
||||
private static LocalDateTime toLocalDateTime(Object raw) {
|
||||
if (raw instanceof java.sql.Timestamp ts) {
|
||||
return ts.toLocalDateTime();
|
||||
} else if (raw instanceof java.time.OffsetDateTime odt) {
|
||||
return odt.toLocalDateTime();
|
||||
} else if (raw instanceof LocalDateTime ldt) {
|
||||
return ldt;
|
||||
private LocalDateTime toLocalDateTime(Object raw) {
|
||||
if (raw == null) return null;
|
||||
if (raw instanceof LocalDateTime ldt) return ldt;
|
||||
if (raw instanceof java.sql.Timestamp ts) return ts.toLocalDateTime();
|
||||
if (raw instanceof java.time.OffsetDateTime odt) return odt.toLocalDateTime();
|
||||
if (raw instanceof java.time.Instant inst) {
|
||||
return inst.atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
|
||||
}
|
||||
log.warn("Unexpected temporal type: {} (class={})", raw, raw.getClass().getName());
|
||||
try {
|
||||
String s = raw.toString();
|
||||
if (s.contains("+") || s.endsWith("Z")) {
|
||||
return java.time.OffsetDateTime.parse(s).toLocalDateTime();
|
||||
}
|
||||
return LocalDateTime.parse(s.replace(" ", "T"));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user