import React from 'react';
import dayjs from 'dayjs';
import Stack from '@mui/material/Stack';
import TextField from '@mui/material/TextField';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
export default function MaterialUIPickers() {
const [value, setValue] = React.useState(
dayjs('2014-08-18T21:11:54'),
);
const handleChange = (newValue) => {
setValue(newValue);
};
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={3}>
<DateTimePicker
label="Date&Time picker"
value={value}
onChange={handleChange}
renderInput={(params) => <TextField {...params} />}
/>
</Stack>
</LocalizationProvider>
);
}
I tried to use this snippet from the docs. I modified a little bit and put it into a sandbox and it seems it's not rendering because of a lot of unidentified errors in the logs. Is there any way to make it work?
https://codesandbox.io/s/material-ui-paper-forked-1ndr6p?file=/src/App.js
I am trying to find a quick solution for this.