mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#686 - Trouble with non-standard java.sql.Date values caching in 7.8.1.
This commit is contained in:
@@ -52,12 +52,19 @@ public abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
|
||||
public String formatValue(T t) {
|
||||
Date date = convertToDate(t);
|
||||
return date.toString();
|
||||
// format all dates into epoch millis
|
||||
long epochMillis = date.getTime();
|
||||
return Long.toString(epochMillis);
|
||||
}
|
||||
|
||||
public T parse(String value) {
|
||||
Date date = Date.valueOf(value);
|
||||
return convertFromDate(date);
|
||||
try {
|
||||
long epochMillis = Long.parseLong(value);
|
||||
return convertFromDate(new Date(epochMillis));
|
||||
} catch (NumberFormatException e) {
|
||||
Date date = Date.valueOf(value);
|
||||
return convertFromDate(date);
|
||||
}
|
||||
}
|
||||
|
||||
public T convertFromMillis(long systemTimeMillis) {
|
||||
|
||||
Reference in New Issue
Block a user