illegal state exception when using interval 'year'

This commit is contained in:
2020-09-20 09:11:45 +02:00
parent 6755411a5d
commit e06f4175a3

View File

@@ -56,6 +56,10 @@ public class StartOfInterval implements TemporalAdjuster {
result = result.with(ChronoField.DAY_OF_MONTH, 1); result = result.with(ChronoField.DAY_OF_MONTH, 1);
break; break;
} }
case YEARS: {
result = result.with(ChronoField.MONTH_OF_YEAR, 1);
break;
}
default: default:
throw new IllegalArgumentException("Unexpected value: " + unit); throw new IllegalArgumentException("Unexpected value: " + unit);
} }