Calendar events are stopped working in version 10.6.4
When we have calendar with Year option it's breaking entire application. see attached error screenshot
Reproducer
No response
PrimeReact version
10.6.4
React version
18.x
Language
ES6
Build / Runtime
Next.js
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.
Can you provide a stackblitz link please ?
Can you provide a stackblitz link please ?
Hi i think its an issue while we are using it with React hook form. normally when i tried its working fine. i will try to generate demo for you. it will take sometime because now i have to fix this issue on production by reverting old version.
OK I used React Hook Form and Calendar and mine is working OK.
<Controller
name="year"
control={form.control}
rules={{ required: 'Year is required.', min: 1960, max: 2050 }}
render={({ field, fieldState }) => (
<>
<label htmlFor={field.name} className={classNames({ 'p-error': errors.year })}>
Year*
</label>
<Calendar
dateFormat="yy"
inputClassName={classNames({ 'p-invalid': fieldState.error })}
inputId={field.name}
inputRef={field.ref}
onBlur={field.onBlur}
onChange={(e) => field.onChange(e.value?.getFullYear())}
value={new Date(field.value, 1, 1)}
view="year"
/>
{getFormErrorMessage(fieldState, field.name, 2050, 1960)}
</>
)}
/>
OK I used React Hook Form and Calendar and mine is working OK.
<Controller name="year" control={form.control} rules={{ required: 'Year is required.', min: 1960, max: 2050 }} render={({ field, fieldState }) => ( <> <label htmlFor={field.name} className={classNames({ 'p-error': errors.year })}> Year* </label> <Calendar dateFormat="yy" inputClassName={classNames({ 'p-invalid': fieldState.error })} inputId={field.name} inputRef={field.ref} onBlur={field.onBlur} onChange={(e) => field.onChange(e.value?.getFullYear())} value={new Date(field.value, 1, 1)} view="year" /> {getFormErrorMessage(fieldState, field.name, 2050, 1960)} </> )} />
https://stackblitz.com/edit/vitejs-vite-4foz9q i have also tried here but its working fine, don't know why my nextjs app isn't working.
can you try 10.6.5 another Calendar fix was just made.