mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX: Backward compatibility to ebean 11
This commit is contained in:
@@ -10,6 +10,7 @@ import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
/**
|
||||
* ScalarType for java.sql.Timestamp.
|
||||
@@ -62,7 +63,11 @@ final class ScalarTypeLocalDateTime extends ScalarTypeBaseDateTime<LocalDateTime
|
||||
|
||||
@Override
|
||||
public LocalDateTime parse(String value) {
|
||||
return LocalDateTime.parse(value);
|
||||
try {
|
||||
return LocalDateTime.parse(value);
|
||||
} catch (DateTimeParseException pe) {
|
||||
return super.parse(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
@@ -123,4 +123,15 @@ public class ScalarTypeLocalDateTimeTest {
|
||||
LocalDateTime value = typeIso.fromJsonISO8601(asJson);
|
||||
assertThat(localDateTime).isEqualToIgnoringNanos(value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseEbean11() {
|
||||
|
||||
ScalarTypeLocalDateTime typeDefault = new ScalarTypeLocalDateTime(JsonConfig.DateTime.ISO8601);
|
||||
|
||||
LocalDateTime fromMillis = typeDefault.parse("1517627106000");
|
||||
LocalDateTime fromIso= typeDefault.parse("2018-02-03T04:05:06");
|
||||
|
||||
assertThat(fromMillis).isEqualToIgnoringNanos(fromIso);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user