Closed bgrochal closed 5 years ago
Can you give a quick example of what was wrong with the previous implementation?
Sure, previous implementation (DateUtils.truncate(wrapped, Calendar.DAY_OF_YEAR)
) throws:
The field 6 is not supported
java.lang.IllegalArgumentException: The field 6 is not supported
at org.apache.commons.lang3.time.DateUtils.modify(DateUtils.java:1103)
at org.apache.commons.lang3.time.DateUtils.truncate(DateUtils.java:819)
....
The simplest way to reproduce is to change Calendar.DAY_OF_MONTH
field back to Calendar.DAY_OF_YEAR
and run my tests. Please refer also to the DateUtilImpl#truncateByDay
implementation (correct) and this solution.
Oh, so it just never worked :laughing: that's pretty clear.
Changes:
Calendar.DAY_OF_YEAR
argument (causingIllegalArgumentException
) switched toCalendar.DAY_OF_MONTH
inEnrichedDate#truncateToDays
implementation,EnrichedDate
implemented.