primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Calendar events are stopped working in version 10.6.4

Open yachtsman-dev opened this issue 1 year ago • 6 comments

When we have calendar with Year option it's breaking entire application. see attached error screenshot Screenshot 2024-05-01 at 4 24 54 PM calendar error

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

yachtsman-dev avatar May 01 '24 10:05 yachtsman-dev

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

github-actions[bot] avatar May 01 '24 11:05 github-actions[bot]

Can you provide a stackblitz link please ?

Rekl0w avatar May 01 '24 11:05 Rekl0w

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.

yachtsman-dev avatar May 01 '24 12:05 yachtsman-dev

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)}
		</>
	)}
/>

melloware avatar May 01 '24 13:05 melloware

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.

yachtsman-dev avatar May 01 '24 13:05 yachtsman-dev

can you try 10.6.5 another Calendar fix was just made.

melloware avatar May 03 '24 14:05 melloware