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.

Cannot Set Initial Date

See original GitHub issue

@vonovak It seems that the date picker cannot be set to an initial date. It always opens to todays date and ignores the value passed to value. Is this the intended behavior?

Thanks in advance for any help you might be able to provide

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nataly-chobatcommented, Mar 4, 2020

The reason was in missing updates. Solved by adding

useEffect(() => {
   if (!isIOS) {
     setSelectedDate(date)
   }
}, [date])

to my component DatePickerModal which renders DateTimePicker and receives date as a prop

Hope it can help you as well @jackfiallos

1reaction
salmanitbcommented, Feb 21, 2020

@jackfiallos use moment… moment.utc(date).local().format(‘MM/DD/YYYY’) and its work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't set a default date value for bootstrap datetimepicker
The variable "myStartDate" is a java.util.date saved in an input hidden field. Is there parameter to set the default value? Any suggestions?
Read more >
Set default values for fields or controls - Microsoft Support
You can set a default value for table fields set to the Text, Memo, Number, Date/Time, Currency, Yes/No, and Hyperlink data types.
Read more >
Not able to set default value of date in date type attribute.
When I am going to set the default value of an attribute it gives me error. Even I have the attribute with Data...
Read more >
Set default value to a date field (in migration) - Laracasts
This means, for example, that you cannot set the default for a date column to be the value of a function such as...
Read more >
Set report date ranges - Looker Studio Help - Google Support
The default date range for your charts and controls depends on their data source. You can change the amount of data shown by...
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