I think there might be a bug in Date.diff - it looks like if the number of days are the same, it attempts to directly cast the incoming Item to a Date in order to compare seconds. However, if the incoming Item is actually a string or something else a cast failure will occur. My fix is below:
Old code:
@Override
public int diff(final InputInfo ii, final Item it) throws QueryException {
final long d1 = days();
final Date d = (Date) (it.date() ? it : type.e(it, null, ii));
final long d2 = d.days();
if(d1 != d2) return (int) (d1 - d2);
return seconds().subtract(((Date) it).seconds()).signum();
}
New code:
@Override
public int diff(final InputInfo ii, final Item it) throws QueryException {
final long d1 = days();
final Date d = (Date) (it.date() ? it : type.e(it, null, ii));
final long d2 = d.days();
if(d1 != d2) return (int) (d1 - d2);
return seconds().subtract(d.seconds()).signum();
}
Dave