Bigkoo/Android-PickerView · error · IllegalArgumentException
The endDate should not be later than 2100
Error message
The endDate should not be later than 2100
What it means
TimePickerView.initWheelTime throws this IllegalArgumentException when only an endDate is configured and its year is later than 2100. The picker's date wheels are capped at year 2100, so a later end date cannot be represented.
Solutions
- Cap the endDate at December 31, 2100 or earlier
- Clamp computed future dates: if (end.get(Calendar.YEAR) > 2100) end.set(2100, Calendar.DECEMBER, 31)
- Validate the configured end year before constructing TimePickerView
Example fix
// before
Calendar end = Calendar.getInstance();
end.add(Calendar.YEAR, 100); // e.g. 2126 -> throws
// after
if (end.get(Calendar.YEAR) > 2100) {
end.set(2100, Calendar.DECEMBER, 31);
} Defensive patterns
Strategy: validation
Validate before calling
if (end != null && end.get(Calendar.YEAR) > 2100) end.set(2100, Calendar.DECEMBER, 31);
Try / catch
try {
TimePickerView pv = new TimePickerView.Builder(ctx).setRangDate(null, end).build();
} catch (IllegalArgumentException e) {
// cap end year at 2100 and rebuild
} Prevention
- Clamp any computed far-future expiry dates to <= 2100-12-31
- Avoid year-9999 'never expires' sentinels with this picker
- Clamp relative offsets like now+N years
When it happens
Trigger: Calling setRangDate(null, endDate) or Builder .setEndDate() with a Calendar whose Calendar.YEAR > 2100, e.g. 'expiry date 100 years from now' computed from the current year, or a sentinel far-future date like 9999-12-31.
Common situations: Computing max dates via Calendar arithmetic (now + N years) without capping; using a 'never expires' sentinel date of year 9999; validation defaults that assume unlimited range.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- startDate can't be later than endDate
- The startDate can not as early as 1900
- type[] length is not 6
- Illegal lunar date, must be like that: year …
AI-assisted analysis of Bigkoo/Android-PickerView@e200d8c063 (2026-09-07).
Data as JSON: /api/errors/543f9670bd896ca9.
Report an issue: GitHub.
Appendix: source
Thrown at pickerview/src/main/java/com/bigkoo/pickerview/view/TimePickerView.java:123
setRange();
}
//若手动设置了时间范围限制
if (mPickerOptions.startDate != null && mPickerOptions.endDate != null) {
if (mPickerOptions.startDate.getTimeInMillis() > mPickerOptions.endDate.getTimeInMillis()) {
throw new IllegalArgumentException("startDate can't be later than endDate");
} else {
setRangDate();
}
} else if (mPickerOptions.startDate != null) {
if (mPickerOptions.startDate.get(Calendar.YEAR) < 1900) {
throw new IllegalArgumentException("The startDate can not as early as 1900");
} else {
setRangDate();
}
} else if (mPickerOptions.endDate != null) {
if (mPickerOptions.endDate.get(Calendar.YEAR) > 2100) {
throw new IllegalArgumentException("The endDate should not be later than 2100");
} else {
setRangDate();
}
} else {//没有设置时间范围限制,则会使用默认范围。
setRangDate();
}
setTime();
wheelTime.setLabels(mPickerOptions.label_year, mPickerOptions.label_month, mPickerOptions.label_day
, mPickerOptions.label_hours, mPickerOptions.label_minutes, mPickerOptions.label_seconds);
wheelTime.setTextXOffset(mPickerOptions.x_offset_year, mPickerOptions.x_offset_month, mPickerOptions.x_offset_day,
mPickerOptions.x_offset_hours, mPickerOptions.x_offset_minutes, mPickerOptions.x_offset_seconds);
wheelTime.setItemsVisible(mPickerOptions.itemsVisibleCount);
wheelTime.setAlphaGradient(mPickerOptions.isAlphaGradient);
setOutSideCancelable(mPickerOptions.cancelable);
wheelTime.setCyclic(mPickerOptions.cyclic);
wheelTime.setDividerColor(mPickerOptions.dividerColor);
wheelTime.setDividerType(mPickerOptions.dividerType);View on GitHub (pinned to e200d8c063)