The displayed date in Material UI Pickers is 1 day behind the selected date:
I selected 25th, the value in formik is 25th but the value displayed on the form is 24th.
"@date-io/date-fns": "^1.3.13",
"date-fns": "^2.9.0",
import DateFnsUtils from '@date-io/date-fns';
import { MuiPickersUtilsProvider, DatePicker } from '@material-ui/pickers';
import { format, addDays } from 'date-fns';
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<FastField
as={DatePicker}
variant="inline"
disableToolbar
name="startTime"
format="PPP"
onChange={date => {
console.log(format(date, 'yyyy-MM-dd'));
setFieldValue('startTime', format(date, 'yyyy-MM-dd'));
}}
value={values.startTime}
/>
</MuiPickersUtilsProvider>
format(endOfDay(new Date(date)), 'yyyy-MM-dd')
but no change – Ulrickimport MomentUtils from '@date-io/moment';
ref: material-ui-pickers.dev/getting-started/installation – Ollieollis