question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defaultDate doesn't work properly

See original GitHub issue

Hi, When I define the defaultDate prop to the component using a state.date doesn’t look to work correctly.

I got the next:

<DatePicker options={{ defaultDate: new Date(this.state.myDate), setDefaultDate: true, format: 'MM-DD-YYYY' }} />

but when the picker is opened my date is not defined.

Unlike if I define the next:

<DatePicker options={{ defaultDate: new Date('2018-10-20'), setDefaultDate: true, format: 'MM-DD-YYYY' }} />

It works.

Expected behavior: I should be able to see my state.myDate as the default in the picker.

Actual behavior: The actual date ( at the moment of open the picker) is the default

Versions

react-materialize: 3.3.0 materialize-css: 1.0.0 react: 16.8.6

Thanks for helping out!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
victorw999commented, Aug 9, 2019

format should be lowercase
format: “mm-dd-yyyy” Date format options

https://codesandbox.io/s/winter-silence-97yg9

0reactions
alextrasterocommented, Aug 13, 2019

Thanks @victorw999, good catch, closing this then

Read more comments on GitHub >

github_iconTop Results From Across the Web

JQuery Datepicker Default Date Not Working When Two on ...
I'm using Jquery datepickers to collect two dates on the same page, the calendars display correctly and I' ...
Read more >
defaultDate not work · Issue #192 · tempusdominus/bootstrap-4
I followed the demo, set the default date, and there is no way to work properly. What should I do? I set the...
Read more >
Date Field “Default Date” doesn't work - WordPress.org
Hey Guys, i want the Datepicker to grey out the next 9 Days from Today. I read that the field Default Date is...
Read more >
Powerapps not picking up default Date setting
I am building a Powerapps form based on a SharePoint List. In the SharePoint Settings, I have set the date field to default...
Read more >
Default Date Format Not Working - Zoho Cares
I have a registration application I am working on which has a main registration form. The application also has a form to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found