Skip to content

Conversation

@Coderxrohan
Copy link
Contributor

Issue:
In DatePicker range mode, the selected value is an array ([startDate, endDate] or [Date, null]), but year-selection logic treated it as a single Date. This caused getFullYear() to be called on non-Date values, resulting in a runtime crash when opening the year picker.

Fix:
Updated the year-selection logic to correctly handle array-based values by normalizing the selection before accessing year data. Array (range/multiple) cases are now handled before single-date logic, ensuring getFullYear() is only called on valid Date instances.

Fixes #8468
([v11] Datepicker: Error when trying to select the year after selecting a date in range mode.)

@Coderxrohan
Copy link
Contributor Author

@ThiagoBarbosaDev thanks for the clear bug report and repro steps — they helped a lot. I’ve submitted a fix handling range values correctly in the year picker. Please feel free to verify and let me know if any adjustments are needed.

Copy link

@x10vaishnavi x10vaishnavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked through the changes — handling the array cases before the single date logic is the right call.
This will really avoids the crash and keeps the year picking logic clean..

@melloware melloware requested a review from tanerengiiin January 9, 2026 14:09
@melloware melloware added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Jan 9, 2026
@melloware
Copy link
Member

Assigned to PrimeTek to review

@Coderxrohan
Copy link
Contributor Author

Assigned to PrimeTek to review

Thanks for the update. Happy to wait for the PrimeTek review.
Let me know if any changes or follow-ups are needed from my side.

@melloware
Copy link
Member

@Coderxrohan much appreciated all your work and your thorough explanations! They really help maintainers.

@Coderxrohan
Copy link
Contributor Author

Hi @tanerengiiin / PrimeTek team,
Just checking in to see if there are any updates or further changes needed from my side to move this forward.
Thanks!

@melloware
Copy link
Member

@Coderxrohan looks like you have a merge conflict?

@Coderxrohan Coderxrohan force-pushed the fix/datepicker-range-year-crash branch from 933b9e6 to 1f8222c Compare January 24, 2026 14:10
@Coderxrohan
Copy link
Contributor Author

@Coderxrohan looks like you have a merge conflict?

Hi @melloware, I’ve rebased the branch on the latest v11 and resolved the merge state.
Could you please confirm if everything looks correct now, or if any further revisions are needed ?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Pending Review Issue or pull request is being reviewed by Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants