@@ -59,7 +59,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
|
||||
|
||||
// In order to retain back compatibility we only register Date/Calendar
|
||||
// types when a user defined formatter is specified (see SPR-10105)
|
||||
if(this.dateFormatter != null) {
|
||||
if (this.dateFormatter != null) {
|
||||
registry.addFormatter(this.dateFormatter);
|
||||
registry.addFormatterForFieldType(Calendar.class, this.dateFormatter);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
|
||||
private static class CalendarToLongConverter implements Converter<Calendar, Long> {
|
||||
|
||||
public Long convert(Calendar source) {
|
||||
return source.getTime().getTime();
|
||||
return source.getTimeInMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +123,10 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
|
||||
|
||||
private static class LongToCalendarConverter implements Converter<Long, Calendar> {
|
||||
|
||||
private final DateToCalendarConverter dateToCalendarConverter = new DateToCalendarConverter();
|
||||
|
||||
public Calendar convert(Long source) {
|
||||
return this.dateToCalendarConverter.convert(new Date(source));
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(source);
|
||||
return calendar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
|
||||
|
||||
// In order to retain backwards compatibility we only register Date/Calendar
|
||||
// types when a user defined formatter is specified (see SPR-10105)
|
||||
if( this.formatters.containsKey(Type.DATE_TIME)) {
|
||||
if (this.formatters.containsKey(Type.DATE_TIME)) {
|
||||
addFormatterForFields(registry,
|
||||
new ReadableInstantPrinter(dateTimeFormatter),
|
||||
new DateTimeParser(dateTimeFormatter),
|
||||
|
||||
Reference in New Issue
Block a user