#2165 - Joda LocalDate West of UTC converts incorrectly (Fix: change from epoc millis conversion to y/m/d conversion)

This commit is contained in:
rob bygrave committed 2021-02-14 10:28:55 +13:00
1 parent d567872813
commit 9e3d6c6a08
2 files changed
+21 -2

No files matched your search

@@ -37,9 +37,10 @@ public class ScalarTypeJodaLocalDate extends ScalarTypeBaseDate<LocalDate> {
return LocalDate.fromDateFields(date);
}
@SuppressWarnings("deprecation")
@Override
public Date convertToDate(LocalDate value) {
return new java.sql.Date(convertToMillis(value));
return new Date(value .getYear() - 1900, value .getMonthOfYear() - 1, value .getDayOfMonth());
}
@Override
@@ -53,7 +54,7 @@ public class ScalarTypeJodaLocalDate extends ScalarTypeBaseDate<LocalDate> {
@Override
public LocalDate toBeanType(Object value) {
if (value instanceof java.util.Date) {
return convertFromMillis(((java.util.Date) value).getTime());
return LocalDate.fromDateFields((java.util.Date)value);
}
return (LocalDate) value;
}