Fix #8052 year not updated with viewDate changes#8135
Fix #8052 year not updated with viewDate changes#8135ulgyd0gg wants to merge 1 commit intoprimefaces:masterfrom
Conversation
|
Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>. |
|
@ulgyd0gg unfortunately this fix for year just keeps going back and forth. See the list of tickets in the past for "year not updating" issues: https://github.com/primefaces/primereact/pulls?q=is%3Apr+year+is%3Aclosed I think your fix is just putting it back how it was and fixed a couple of scenarios but breaks a few more. Look at the Git Blame on those lines of code to see last ticket and fix |
|
@melloware I thought about these during the changes. What’s the desired behavior—should currentValue become null if value is empty, defaulting to currentValue || metaYear? Or should we always use the last selected value? I’d like the core team’s input on this. |
|
@ulgyd0gg i have fixed this back and forth over the years and i am not sure what the right solution is. I have fixed it for people to fix one scenario and then another bug gets reported. Ideally we would have a list of of all test cases and make sure they all work. |

Fix #8052
Fix #8258
The issue occurred when we set the view date and deleted the input field. The currentYear variable retained the old value (in this case, 2000).😶🌫️
primereact/components/lib/calendar/Calendar.js
Lines 3391 to 3393 in d57bbb7
I adjusted displayYear to use metaYear, which fixes the issue, and the yearNavigator works correctly. However, if we modify the value of InputRef.current.value in a way that it cannot be parsed as a Date, the rendering will fall back to using ViewDate as the parameter.😺