chrisdavies / tiny-date-picker

A small, modern, dependency-free date picker
https://chrisdavies.github.io/tiny-date-picker/
415 stars 88 forks source link

Timezone is ignored #97

Open j6s opened 5 years ago

j6s commented 5 years ago

When using tiny-date-picker in a timezone that is not GMT the date objects in the state do not always correspond to the correct dates in your timezone.

Example: https://codepen.io/j6s/pen/OaZyLJ

screenshot_2018-11-23_17-13-39

As you might have guessed from the screenshot I am currently in GMT+1 - thus the date in my screenshot is off by one hour.

Without digging deeper into the code it seems like the date is selected as a GMT timestamp but then used to create a Date object which is in my local timezone.