Bigkoo/Android-PickerView · error · IllegalArgumentException
The startDate can not as early as 1900
Error message
The startDate can not as early as 1900
What it means
TimePickerView.initWheelTime throws this IllegalArgumentException when only a startDate is configured and its year is earlier than 1900. The underlying wheel/date tables only support years from 1900, so an earlier start date cannot be represented.
Solutions
- Raise the startDate to January 1, 1900 or later
- If older dates are needed, this library cannot support them — pick another date library
- Validate the configured start year before constructing TimePickerView
Example fix
// before Calendar start = Calendar.getInstance(); start.set(1899, Calendar.JANUARY, 1); // throws // after start.set(1900, Calendar.JANUARY, 1); // minimum supported
Defensive patterns
Strategy: validation
Validate before calling
if (start != null && start.get(Calendar.YEAR) < 1900) start.set(1900, Calendar.JANUARY, 1);
Try / catch
try {
TimePickerView pv = new TimePickerView.Builder(ctx).setRangDate(start, null).build();
} catch (IllegalArgumentException e) {
// clamp start year and rebuild
} Prevention
- Never use sentinel/epoch-zero Calendars as minimum dates
- Clamp start year to >= 1900
- Remember this library cannot represent pre-1900 dates at all
When it happens
Trigger: Calling setRangDate(startDate, null) or Builder .setStartDate() with a Calendar whose Calendar.YEAR < 1900 (e.g. an epoch-based Calendar of 0ms, or a 'birth date' field defaulting to year 1900 minus something).
Common situations: Passing new Calendar.Builder().setDate(0,0,1) or Calendar.getInstance() zeroed to epoch (1970 is fine, but year-0 defaults are not); using a minimum-date placeholder like 1899; misreading the supported 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 endDate should not be later than 2100
- 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/b0e262a6e8bbfcc4.
Report an issue: GitHub.
Appendix: source
Thrown at pickerview/src/main/java/com/bigkoo/pickerview/view/TimePickerView.java:117
}
wheelTime.setLunarMode(mPickerOptions.isLunarCalendar);
if (mPickerOptions.startYear != 0 && mPickerOptions.endYear != 0
&& mPickerOptions.startYear <= mPickerOptions.endYear) {
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);View on GitHub (pinned to e200d8c063)