DEV Community

Matthew Horvat
Matthew Horvat

Posted on

Material UI Datepicker and @date-io/date-fns 2.0.0

The Need

I was working on a project at work, being it was a React project and needing a datepicker, it was time to try the MaterialUI Datepicker.

Installing the packages

Following the documentation at material-ui my dependencies looked like this.

Alt Text

Copying and pasting the example in:
Alt Text

Fail Whale

I was greeted with the following result:
Alt Text

The Googling

Like all good developers I began to google and found a Github issue that matched my problem. The solution was to use an earlier version of the @date-io/date-fns library since a new 2.0.0 version had just come out 4 days prior and @material-ui had issues with it, being it was newer than the last release of material.

Downgrading

So I downgraded to the earlier version and this was the dependencies I ended up with:
Alt Text

Success

Finally after choosing the earlier version I was successful.
Alt Text

** Sometimes newer isn't always better **

Top comments (1)

Collapse
 
hariprasadr92 profile image
Hariprasad Ramakrishnan

Faced the same issue and solved it the same way few days back. Looks like we walked through the same path.