-
Notifications
You must be signed in to change notification settings - Fork 1k
simple fix to allow override on timezone value #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes this fixed it after spending hours!! thanks |
That's great, I was just looking for how to make the "Now" button set the time in GMT instead of local time. Sounds like this is exactly what I need. |
In the $.extend(TimePicker.prototype), _newInst function definition, there's a section where we build up a new instance and populate its fields with values from the _defaults object. I added the following:
near the section of code where the hour, minute, etc... fields are assigned, like so:
Is this a correct alternative fix for this issue? (v.0.9.7) |
This doesn't work for me. I've added the two fixes mentioned above, but if I try overriding the timezone to America/New_York and I set my local time to India Standard Time and click the "Now" button it always changes the value to India Standard Time. |
I agree with redijedi - wilwayco fixes the problem, except if you click Now at which time the default TZ is put back into the input. I just hid the Now button using CSS ;-) |
What would be involved in adding an option that made the "Now" button always use a timezone you specify? I've got a use-case for "Now" meaning "Now, in GMT" as well. Going to hide the Now button with CSS, but I'd love to have the functionality. |
I need the same functionality as fvox13. I'm working a system where the user can pick a time zone they want all of their time zones in for both display end editing (it will often be a different time zone than the one they have their computer set to), and I need it so that clicking 'Now' yields a date/time in the selected time zone ... the way it works now it ALWAYS gives a the current date/time in the computer's local time zone. |
+1 to fix this issue.
|
What is the status of this one? |
I'd also like to see this feature implemented. (hitting "now" would fill the field with eg UTC) |
I applied the changes mentioned by @gwikle however after further testing it was not working properly. For example in the docs the first example I press Now and I 17:50 when I should have gotten 11:50. I am at -0400 timezone so perhaps instead of subtracting it should have added the timezone (it would be negated tzoffset). I applied this tweak to the dev branch. |
Hello,
I am creating an application, and your fork has helped me out a lot. I ran into a small problem, and that was trying to override the default value for timezone wasn't working, it was always defaulting to the hard-coded value, even though I was putting the correct information upon creating the object.
The timezone field wasn't working, I tracked it down and my fix was as follows:
Inside the function _injectTimePicker, add this line:
// override default timezone value
this.timezone = o.timezone;
Before this line, "if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {"
That should allow you to override the default timezone value. Hope this saves someone else some time.
The text was updated successfully, but these errors were encountered: