time-picker icon indicating copy to clipboard operation
time-picker copied to clipboard

Unable to edit time while using inside form

Open ujjwal313 opened this issue 10 months ago • 3 comments

I am using TimePicker inside form but I am unable to change the time only TimePeriod selector is working.

 <FormField
            control={form.control}
            name="startTime"
            render={({ field }) => (
              <FormItem>
                <FormLabel>Start Time</FormLabel>
                <FormControl>
                  <TimePicker date={field.value} setDate={field.onChange} />
                
                </FormControl>
                <FormMessage />
              </FormItem>
            )}
          />

https://github.com/user-attachments/assets/2fc89eeb-c3de-4e19-a17d-06ae8f9b1f79

ujjwal313 avatar Feb 17 '25 00:02 ujjwal313

Hard to tell from the code snippet.

Is the name="startTime" correct?

We have published an example with react-hook-form and the calendar button on time.openstatus.dev is being used within a form.

Otherwise, feel free to share a reproducible project where I can dig in.

mxkaske avatar Feb 17 '25 07:02 mxkaske

@mxkaske Yes, the name="startTime" is correct.

I am using the same time-picker-demo-12h.tsx from Docs.

Only difference is I have removed the seconds input field and related ref and I am using the form inside shadcn Dialog.

I will create a reproducible example

ujjwal313 avatar Feb 17 '25 07:02 ujjwal313

To be fair, I haven't tested the 12h demo within a form. So this might be checked indeed. Will try to find time over the week.

mxkaske avatar Feb 17 '25 07:02 mxkaske