Topic: MDBDatePicker Gives Warnings
Hi thanks for the help, I'm not sure if this is something that I'm doing or a issue with my larger code or is it an error in the component, but I'm having issues with MDBDatePicker and the functions with it. It seems to work ok, but is producing warnings in the console.
*Expected behavior*When the <MDBDatePicker />
component is used, it should not produce multiple warnings in the console. Even the simple implementation provided in the documentation produces warnings in my implementation within the console.
*Actual behavior*The <MDBDatePicker />
is giving the following console warnings when used in the component.
- Warning: Failed prop type: Invalid prop
TextFieldComponent
supplied toDateTextField
. - Warning: Material-UI: theme.spacing.unit usage has been deprecated.
- Warning: Material-UI: the key
action
provided to the classes property is not implemented in ForwardRef(DialogActions).
*Resources (screenshots, code snippets etc.)*The component is added to the react component as the following: <MDBDatePicker getValue={this.getTheDate} />
I can provide the rest of the code if this isn't sufficient enough to reproduce the warnings.
Konrad Stępień staff answered 5 years ago
Hi @heath140,
Can you use this code in your project?
import React from "react";
import { MDBContainer, MDBDatePicker } from "mdbreact";
class Test extends React.Component {
render() {
return (
<MDBContainer>
<MDBDatePicker getValue={e => console.log(e)} />
</MDBContainer>
);
}
}
export default Test;
For me, this code works correctly. Without warnings etc.
Can you send more code of your project and dependencies
without the key for git?
Best, Konrad
heath140 pro premium answered 5 years ago
Hey, sorry I left on Vacation. Attached is the whole file. The date picker is used on line 331. Here is a link to the file that uses it. https://www.dropbox.com/s/vl876ez7ampptse/CertDetails.js?dl=0
Thanks!
Konrad Stępień staff answered 5 years ago
Hi @heath140
Maybe the problem is in 68 lines?
Can you replace
date: props.theCert.Cert_Details
? props.theCert.Cert_Details.date
? moment(props.theCert.Cert_Details.date)
: ''
: '',
for this
date: props.theCert.Cert_Details
? props.theCert.Cert_Details.date
? `${moment(props.theCert.Cert_Details.date)}`
: ''
: '',
I think you have an error because moment
give you data in a different format than expected. I'm not sure because I need a little more time to test it. But I hope that the error will disappear in this way, if not then we will look for a different solution.
Best regards, Konrad.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB React
- MDB Version: 4.18.0
- Device: Desktop computer
- Browser: Firefox 68.0.1
- OS: macOS 10.14.5
- Provided sample code: No
- Provided link: No