Calendar gives one day earlier date instead of the selected date
See original GitHub issueWhen 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://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:
- Created 3 years ago
- Comments:13 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
<Calendar onSelect={(nextDate) => alert(
this is your local time converted from UTC: ${new Date(nextDate)}) } />