trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

Pressing 'Now' button more than once results in Na:Na for time, and freezes slider controls when they are displayed. Here is the fix (for version 1.6.1 and later), please incorporate it. #845

Open thuckabay opened 8 years ago

thuckabay commented 8 years ago

Hi Trent,

I love your "date time picker" control, and am new to it. I have found that sometime between version 1.4.5 and 1.6.1, a serious bug was introduced affecting use of the Now button, so that using that button more than once in a control instance results in Na:Na for the time and ALSO may freeze the slider controls to select the hour and minute when those are displayed. This is being caused by a failure to parse a string to an integer:

now.setMinutes(now.getMinutes() + now.getTimezoneOffset() +tzoffset);

The above line should read:

now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + parseInt(tzoffset));

Please correct your latest version to include parseInt() around tzoffset, and that will eliminate the bug.

Thanks, and keep up the great work. (I examined a number of date-time picker controls, some free and some not, and yours is excellent.)

T. Huckabay

andriiash commented 8 years ago

Please, see the issue #843

thuckabay commented 8 years ago

Issue 843 is different.

andriiash commented 8 years ago

I didn't say that the issue is the same instead of the reason (and fix). Now it fixed with parseInt() in the timezoneOffsetNumber() function that returns the tzoffset value.

RodrigoBalest commented 8 years ago

I'm using v1.6.1 and had the same issue. The suggestion posted by @thuckabay worked fine for me.

niparasc commented 8 years ago

@thuckabay 's solution worked fine for me too.

bdm4 commented 8 years ago

Note this bug also occurs in $.timepicker.timezoneAdjust function.

keeehlan commented 8 years ago

@thuckabay, excellent job. I was just digging around in the same code hoping to find a solution, but you had already handled that.

I really hope @trentrichardson gets wind of this and pushes an update - it's been quite a while.

trentrichardson commented 8 years ago

I applied the fix in the dev branch just now. Hope this helps out. I will do my best to get this all merged to master soon.

Also, if anyone is interested in participating in this project as a team member see this post: https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues/874 Long story a couple reliable developers willing to spend a few minutes here and there would be a huge help in applying these fixes, helping with testing, documentation, etc. I don't mind putting your name in the docs as a team member so you get recognition as well.

keeehlan commented 8 years ago

@trentrichardson Good stuff, man. Thanks for chiming in. Really appreciate your work.

MrPetovan commented 8 years ago

I found that this issue is actually coming from _onTimeChange which sets the timepicker timezone as a string: Line 828 of jquery-ui-timepicker-addon.js version v1.6.1

if (timezone !== false) {
    timezone = timezone.toString();
}

I only had to change it to:

if (timezone !== false) {
    timezone = parseInt(timezone);
}

I know there already is a larger commit about fixing this issue, just wanted to add my 2 cents.