https://codesandbox.io/s/NlwLPp88
See the console log on day click:
Tue Jul 04 2017 **12:00:00** GMT+0300 (MSK)
Yup this is by design to prevent issues with timezones.
See https://github.com/gpbl/react-day-picker/issues/130
If you want to change the time, just create a new date with the clicked day:
onDayClick = day => {
console.log(
new Date(day.getFullYear(), day.getMonth(), day.getDate())
);
}
By the way, in case you're curious, this doesn't prevent issues with timezones.
If there were only UTC-12 through UTC+11 time zones (24 total) then it would work.
However, there are also UTC+12, UTC+13 and UTC+14 time zones so there's actually 27 different time zones so the "12:00" workaround can not be considered a solution to the timezone issue.
E.g. 12:00 in UTC-12 is 00:00 of the next (not the same) day in UTC+12, and is 02:00 of the same next day in UTC+14 time zone.
Still, these extra 12 hours do make sense and do help make things less weird.
These extra 12 hours are a hack to make things
a little bit less weird when rendering parsed dates.
E.g. if a date Jan 1st, 2017 gets parsed as
Jan 1st, 2017, 00:00 UTC+0 (England) then when displayed in the US
it would show up as Dec 31st, 2016, 19:00 UTC-05 (Austin, Texas).
That would be weird for a website user.
Therefore this extra 12-hour padding is added
to compensate for the most weird cases like this
for adjacent countries / neighbours / same continent countries.