I’m using React Hook Form and have three input fields in a form: a start date, an end date, and a third field that shows the number of nights between the two dates (night difference). I want to update the night difference field whenever the start date or end date fields change. I’m working on the form for booking a vacation by employee, night duration is calculated automatic and also for informational purposes for employee.
I wonder is there a way too not using onChange but inside place the code inside {…register, {…HERE…}}
This is my solution https://codesandbox.io/p/sandbox/chz4z8.