Tried every possible solutions I found in internet. I upgraded all the dependencies and packages using yarn - below from package.json
"dependencies": {
"@date-io/date-fns": "^1.3.13",
"@date-io/moment": "^1.3.13",
"@material-ui/core": "^5.0.0-beta.2",
"@material-ui/icons": "^5.0.0-beta.1",
"@material-ui/lab": "^5.0.0-alpha.41",
"@material-ui/pickers": "^4.0.0-alpha.12",
"@material-ui/styles": "^5.0.0-beta.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"date-fns": "^2.22.1",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
}
Before upgrading packages I used:
import {
MuiPickersUtilsProvider,
KeyboardDatePicker,
} from '@material-ui/pickers';
After then I imported these:
import LocalizationProvider from '@material-ui/lab/LocalizationProvider';
import AdapterDateFns from '@material-ui/lab/AdapterDateFns';
and tried below code:
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Grid container justifyContent="space-around">
<DatePicker
disableToolbar
variant="inline"
format="DD/MM/yyyy"
margin="normal"
label="Date"
name="date"
value={values.date}
onChange={(date) => handleInputChange(convertToDefault(date))}
/>
</Grid>
</LocalizationProvider>
Can you help me out? It's quite hassle :/
use this version works fine for me...yarn add @material-ui/core@4.11.4 @material-ui/pickers
"@material-ui/core": "4.11.4",
"@material-ui/pickers": "^3.3.10",
- import { fade } from '@material-ui/core/styles';
+ import { alpha } from '@material-ui/core/styles';
const classes = makeStyles(theme => ({
- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity),
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
}));
Hi I don't think it's a part of @material-ui/pickers any more. You can check this https://github.com/mui-org/material-ui-pickers/issues/2157
For me its working fine with exact these version. Use the exact same versions and thanks me later. If it not allowed you installation then use --force flag.
"@material-ui/core": "^4.11.4",
"@material-ui/pickers": "^3.3.10",
You cannot use 'fade' from material-ui anymore, as this is deprecated. You can use 'alpha' instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.