Change calendar month Programmatically in Material UI

I am using Material UI DatePickers https://material-ui-pickers.dev/demo/datepicker, I have two DatePickers From and To. what I want to achieve is when I change the month of From DatePicker then it should also change the month of To DatePicker. But I want only Month to change in TO DatePicker, date should remain unselected in DatePicker. Thanks in advance for help, below is my Html

      onChange = (newDate) => { setEndDate(newDate); }        <DatePicker         disableToolbar         variant="inline"         label="Only calendar"         helperText="No year selection"         value={startDate}         onMonthChanged={onChange}       />         <DatePicker         disableToolbar         variant="inline"         label="Only calendar"         helperText="No year selection"         value={endDate}       /> 

I have called the above function onChange on onMonthChange() and inside it I am setting the end date which is TO Date, months gets changed but date also remains selected. how to only set month??

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.