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.

DatePicker incorrect time value

See original GitHub issue

Environment

Tech Version
@material-ui/pickers 3.2.5
material-ui 4.3.3
React 16.8.6
Browser any
Peer library @date-io/date-fns”: “^1.3.11”

Steps to reproduce

  1. Use any DatePicker component, listen date prop in onChange callback
  2. Click any date on UI.

Expected behavior

I except selected date with midnight time, like this: Tue Sep 10 2019 00:00:00 GMT+0300 (GMT+03:00)

Actual behavior

Now onChange cb passing date like this: Tue Sep 10 2019 10:02:00 GMT+0300 (GMT+03:00) with current time.

Gif example

1

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
PasVVcommented, Sep 12, 2019

Thank you, problem solved. 😃 As i see, i missed initialFocusedDate prop in docs.

1reaction
dmtrKovalenkocommented, Sep 12, 2019

Then it will use new Date() as a basic You can pass initialFocusedDate={startOfDay(newDate)}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a RangeError: Invalid Time Value when using React ...
I have set up a DatePicker component using the react-datepicker library and am passing it an initial date value calculated using today's ...
Read more >
throw out RangeError('Invalid time value') · Issue #1752 - GitHub
Expected behavior Hello, I want to use the component to select date, but it keeps throwing out Invalid time value error. No idea...
Read more >
Module Builder: Datepicker shows incorrect time when setting ...
Setting a DateTime field value shows a different time when editing the item in the backend.
Read more >
RangeError: Invalid time value in JavaScript | bobbyhadz
The "Uncaught RangeError: Invalid time value" error occurs when calling a method on an invalid date, e.g. new Date('asdf').toISOString() . To solve the...
Read more >
DateTimePicker incorrect parsing when user types in date
Since provided format includes the time format and the entered value does not contain the same (input element value will only contain date ......
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