DatePicker year picker is capped at 201 options, ignoring `numOfYears`
- Dominant language
- Kotlin
- Stars
- 693
- Forks
- 123
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 34
Description
In `DatePicker.kt`, `DatePickerState` computes `numOfYears` to widen the year picker
when the range spans more than 200 years, but the value is never used — `yearState` is
built with a hardcoded `201`.
```kotlin
private val numOfYears =
if (toDate != null && (toDate.year - startYear) > 200) {
toDate.year - startYear + 1
} else {
201
}
val yearState =
PickerState(initialNumberOfOptions = 201, initiallySelectedOption = date.year - startYear)
```
So with `fromDate = 1850-01-01` and `toDate = 2100-01-01`, `startYear` is 1850 and 251
options are needed, but the picker still gets 201. The year wheel ends at 2050 and wraps
back to 1850, so 2051–2100 can't be selected at all.
The fix seems straightforward (replacing the hardcoded `201` with `numOfYears`).
Would it be OK if I worked on this and opened a PR?
Contributor guide
Research direction
Start in DatePicker.kt at DatePickerState, where numOfYears is computed and yearState is initialized. Replace the hardcoded option count with the computed value, then verify the 1850–2100 range provides 251 options and allows selecting years through 2100.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 91/100