trentrichardson/jQuery-Timepicker-Addon — Issue #330: Issue with daylight saving time
Author: juicedM3
Created: 2012-03-03 18:36:51+00:00
State: open

Background: We have a RoR application that supports many clients across the US. The application timezone is set to UTC and all times are stored in UTC. When we go to display or edit product, we convert the times to the appropriate timezone so that the user doesn't have to do any timezone calculations. We added the timepicker-addon so that we could give administrators a user friendly interface to modifying datetimes.

Given: We have products that have a valid start and stop selling dates. The start/stop times are set as follows:

- start_time = "01/01/2012 12:00 AM -0800" # 1/1/2012 12:00:00 AM PST
- stop_time = "03/01/2012 12:00 AM -0800" # 3/1/2012 12:00:00 AM PST

We initialize the datetimepicker using the following parameters:

$('#product_start_time').datetimepicker({
ampm: true,
timeFormat: 'h:mm TT z',
setDate: new Date("<%= start_time %>")
});

Everything works great up to this point. However, say they want to extend the product's stop time to June 1st, 2012. We change the field accordingly but the timezone doesn't change. datetimepicker will return a stop time of: 06/01/2012 12:00 AM -0800. It should return 06/01/2012 12:00 AM -0700 which gives us 6/1/2012 12:00:00 AM PDT. A time of 6/01/2012 12:00 AM -0800 gives us 6/1/2012 1:00:00 AM PST.

If I'm doing anything wrong, please let me know or if there's anyway to work around this. Thanks!

Additional Info:

timepicker: v0.9.9 (briefly tried 0.9.8 & 1.0.0)
OS: MacOS X 10.7.3
Browser: Firefox 10.0.2 & Chrome 17.0.963.56
rails: 3.1.3
ruby 1.8.7