i am trying to make a booking without submit button i have many buttons to select a time and a date picker
i want data to be submited when date and time buttons are clicked
i am not able to get the time value also
var doctorid = props
const [dateState, setDateState] = useState(new Date());
const changeDate = (e) => {
setDateState(e);
};
function booking() {
const data = {
date: dateState,
time: "12:pm",/// time button value must come here
doctor: doctorid,
};
this is the jsx
<Calendar value={dateState} onChange={changeDate} />
<TabPanel>
<button style={styles.button}>9:00am</button>
<button style={styles.button}>9:30am</button>
<button style={styles.button}>10:00am</button>
<button style={styles.button}>10:30am</button>
<button style={styles.button}>11:00am</button>
<button style={styles.button}>11:30am</button>
<button style={styles.button}>12:00pm</button>
</TabPanel>
<TabPanel>
<button style={styles.button}>6:30pm</button>
<button style={styles.button}>7:00pm</button>
<button style={styles.button}>7:30pm</button>
<button style={styles.button}>8:00pm</button>
</TabPanel>
i am not able to get the time value also
setDateState(e) should be setDateState(e.target.value);