You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example I'm trying to call method updateViewDate, passing null inside it.
But in fact, I'm getting the error while pressing the button:
If I try to check the source code from the link in call stack, I will see that the method updateViewDate calls setCurrentMonth(value.getMonth()) without checking for truthy of value (the same thing for year property).
Note: the API of this method is documented, that it can accept Nullable (value: Nullable<Date | Date[]>)
My suggestion is to check value for truthy before trying to set month/year in this method.
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Apr 19, 2024
Describe the bug
I have this example code, where I need to reset calendar's date manually via its API (https://primereact.org/calendar/#api.Calendar.methods).
In this example I'm trying to call method updateViewDate, passing null inside it.
But in fact, I'm getting the error while pressing the button:
If I try to check the source code from the link in call stack, I will see that the method updateViewDate calls setCurrentMonth(value.getMonth()) without checking for truthy of value (the same thing for year property).
Note: the API of this method is documented, that it can accept Nullable (value: Nullable<Date | Date[]>)
My suggestion is to check value for truthy before trying to set month/year in this method.
Reproducer
https://codesandbox.io/p/devbox/objective-lena-ypxjyy?file=%2Fsrc%2FApp.tsx%3A22%2C16
PrimeReact version
10.6.3
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
updateViewDate
and passnull
to reset date.Expected behavior
No response
The text was updated successfully, but these errors were encountered: