I have six inputs type date, four of them are read-only. When I choose a date on the first one, I calculate that date and put the values on the read-only inputs, and I choose a date in the last input after that I click the button. I want to console.log() all of the dates, and get errors if the the inputs are empty.
As you can see in the picture, only the first and last dates are logged because the OnChange event is triggered, but I want to log the the other two in red too, and it's not working out with me

Here's what I have done:
import { React, useState } from "react";
import moment from "moment";
export default function Test() {
const [date, setdate] = useState({ date1: "", date2: "", date3: "", date4: "" });
const [error, seterror] = useState("");
const handleChange = (event) => {
const value = event.target.value;
setdate({
...date,
[event.target.name]: value
});
}
const handleClick = (event) => {
event.preventDefault();
if (date.date1 === "" || date.date4 === "") {
seterror("error")
} else {
console.log("bye")
seterror("")
console.log(date)
}
};
function addDays(date, days) {
if (!date) {
return ''
} else {
var result = new Date(date);
result.setDate(result.getDate() + days);
var res = moment(result).format("YYYY-MM-DD")
return res;
}
}
return (
<div>
<div className="widget widget-chart-one">
<form>
<label>تاريخ القرار</label>
<input type="date" className="form-control" name="date1" onChange={handleChange}
/>
<label>تاريخ النشر </label>
<div className="form-group row mb-6">
<div className="col-sm-6">
<input type="date" className="form-control" value={date.date1} readOnly />
</div>
<div className="col-sm-6">
<input type="date" className="form-control" name="date2" value={addDays(date.date1, 15)} onChange={handleChange} readOnly />
</div>
</div>
<label >فترة البحث العمومي </label>
<div className="form-group row mb-6">
<div className="col-sm-6">
<input type="date" className="form-control" value={addDays(date.date1, 15)} readOnly />
</div>
<div className="col-sm-6">
<input type="date" className="form-control" name="date3" value={addDays((addDays(date.date1, 15)), 9)} onChange={handleChange} readOnly />
</div>
</div>
<label>تاريخ الاجتماع</label>
<div className="form-group row mb-10">
<div className="col-sm-12">
<input type="date" className="form-control" name="date4" onChange={handleChange} />
</div>
</div>
<button className="mr-2 btn btn-primary" type="submit" onClick={handleClick}> تأكيد</button>
<div>
{error && <small className="text-danger"> {error} </small>}
</div>
</form>
</div>
</div>
);
}