Skip to content
Discussion options

You must be logged in to vote

I use something very similar to this and rather than storing the value as a Date object and then converting it as part of the submit handler, I store the value as a string.
So my value and my onChange method house the logic for the conversion.
I use the hours from the date object as I am using a time picker, but I am sure you can apply similar logic for dates.

             <Controller
                name={`openingTimes.${index}.service_hours.${hoursIndex}.from`}
                control={control}
                render={({ field, fieldState: { error, invalid } }) => (
                  <TimePicker
                    {...field}
                    ampm={false}
                    label="f…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@avdb13
Comment options

Answer selected by avdb13
Comment options

You must be logged in to vote
2 replies
@oxuk85
Comment options

@avdb13
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants