Fix DatePicker year picker crash in range mode#8469
Fix DatePicker year picker crash in range mode#8469Coderxrohan wants to merge 1 commit intoprimefaces:v11from
Conversation
|
@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. |
x10vaishnavi
left a comment
There was a problem hiding this comment.
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..
|
Assigned to PrimeTek to review |
Thanks for the update. Happy to wait for the PrimeTek review. |
|
@Coderxrohan much appreciated all your work and your thorough explanations! They really help maintainers. |
|
Hi @tanerengiiin / PrimeTek team, |
|
@Coderxrohan looks like you have a merge conflict? |
933b9e6 to
1f8222c
Compare
Hi @melloware, I’ve rebased the branch on the latest v11 and resolved the merge state. |
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 causedgetFullYear()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 beforesingle-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.)