jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
358 stars 87 forks source link

Fixing bug caused by variable confusion in the readme #67

Closed compwron closed 8 years ago

compwron commented 8 years ago

Credit to @rkofman for finding the bug

jonthornton commented 8 years ago

Can you explain what this PR fixes?

rkofman commented 8 years ago

Basically, I ended up in a project that used this code sample copy-pasted, and ended up with off-by-one-hour errors that seemed to only happen in the afternoon PST (I'm guessing that's when Greenwich passed into a different date, causing some havoc). I traced it down to the fact that the getTimezoneOffset function returned different values for utc and the v value passed into updateDate.

I haven't gotten it down to exact reproducible steps on my browser, but trusting the passed in value's own timezone offset seems like the right call in any case.

jonthornton commented 8 years ago

Thanks. This commit in this PR had some whitespace issues so I made the change in a separate commit.

compwron commented 8 years ago

:+1:

compwron commented 8 years ago

I do have my editor set to auto-delete trailing whitespace. I didn't notice that when I made the PR, sorry.