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.

Calendar gives one day earlier date instead of the selected date

See original GitHub issue

When used with a single and uncontrolled, Calendar component prop onSelect function gives one day earlier than the seemingly selected date.

Expected Behavior

The date that is given by the onSelect prop should give the date that is selected by the user.

Actual Behavior

Given date by onSelect is one day earlier than the selected date

URL, screen shot, or Codepen exhibiting the issue

https://gbjtf.csb.app

https://codesandbox.io/s/great-bird-gbjtf?file=/src/App.js

Steps to Reproduce

Just visit the above links

Your Environment

Agnostic to env as it can be reproduced both in my env as well as CodeSandBox

  • Grommet version: 2.15.2
  • Browser Name and version: Opera
  • Operating System and version (desktop or mobile): Mac OSx

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
tayseacommented, Nov 23, 2020

Hey @eminx I see that you are on grommet 2.15.2, but I recently submitted a fix that aimed to remove this issue (https://github.com/grommet/grommet/pull/4742) – could you try pointing your application to grommet stable (https://github.com/grommet/grommet/tarball/stable) and see if this issue goes away?


[Shimi] - More info about grommet stable https://github.com/grommet/grommet/wiki/What-is-grommet-stable-and-how-to-use-it%3F

2reactions
msalehycommented, Nov 20, 2020

<Calendar onSelect={(nextDate) => alert( this is your local time converted from UTC: ${new Date(nextDate)} ) } />

Read more comments on GitHub >

github_iconTop Results From Across the Web

datepicker date off by one day - Stack Overflow
The reason you're off by day is because UTC time is for a timezone that is ahead of yours. (Since you didn't also...
Read more >
Datepicker shows one day behind when using yyyy-MM-dd ...
I solved this issue by giving the Date field in Backend as Edm.DateTimeOffset (this will be a Timestamp field in ABAP) & converting...
Read more >
Why is does the date selector show previous date? - Forums
I use a date time picker in my coach. When I select a date and then convert it to a string, it displays...
Read more >
Datepicker returns minus 1 day - Power Platform Community
The date returned to the server from a DatePicker control is consistently one day less than the date entered. So enter, say, April...
Read more >
Date & Time Picker - V-Calendar
v-date-picker can bind to single dates using the v-model directive. ... To limit user selection to only date components (month, day, year), use...
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