Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed May 10, 2021
1 parent d4f87fa commit 1093975
Showing 1 changed file with 3 additions and 9 deletions.
Expand Up @@ -66,25 +66,19 @@ private class ExpansionFilter implements Function<T, List<T>> {
public List<T> apply(T date) {
List<T> retVal = new ArrayList<>();
// construct a list of possible month days..
final int numDaysInMonth = YearMonth.of(getYear(date), getMonth(date)).lengthOfMonth();
final YearMonth yearMonth = YearMonth.of(getYear(date), getMonth(date));
for (final int monthDay : monthDayList) {
if (monthDay == 0 || monthDay < -numDaysInMonth || monthDay > numDaysInMonth) {
if (!yearMonth.isValidDay(Math.abs(monthDay))) {
if (log.isTraceEnabled()) {
log.trace("Invalid day of month: " + monthDay);
}
continue;
}
T candidate;
if (monthDay > 0) {
// if (numDaysInMonth < monthDay) {
// continue;
// }
candidate = withTemporalField(date, DAY_OF_MONTH, monthDay);
} else {
if (numDaysInMonth < -monthDay) {
continue;
}
candidate = withTemporalField(date, DAY_OF_MONTH, numDaysInMonth + 1 + monthDay);
candidate = withTemporalField(date, DAY_OF_MONTH, yearMonth.lengthOfMonth() + 1 + monthDay);
}
retVal.add(candidate);
}
Expand Down

0 comments on commit 1093975

Please sign in to comment.