trentrichardson/jQuery-Timepicker-Addon — Issue #280: Time reset to 0:00 when input Date object has *:45, *:50 or *:55
Author: rickhofstede
Created: 2011-12-08 10:02:49+00:00
State: open

For my project I use two date picker instances, "#datepicker1" and "#datepicker2". For copying time from one date picker to another - let's say from "#datepicker1" to "#datepicker2" - I use the following command:

```javascript
$('#datetime1').datetimepicker('setDate', new Date($('#datetime2').datetimepicker('getDate')));
```

This construct generally works fine. However, when the selected time in "#datepicker1" looks like *:45, *:50 or *:55, the time in "#datepicker2" will be reset to 00:00. When I execute the command again, it works fine though. Surprisingly enough, it works properly between *:00 and *:40.

Both date pickers are instantiated as follows:

```javascript
$('#datetime1').datetimepicker({
hour: hours1,
minute: minutes1,
maxDate: new Date(latestDate.substr(0, 4), latestDate.substr(4, 2) - 1, latestDate.substr(6, 2), latestHour, latestMinute),
stepMinute: 5
});
```

To trace down the issue, I printed the following to the console, directly after the 'setDate' instruction in the command above:
$('#datetime2').datetimepicker('getDate') - works fine
new Date($('#datetime2').datetimepicker('getDate')) - works fine

So at this point, I expect the 'setDate' instruction to be erroneous.

I'm using the following versions:
- jQuery: 1.6.2
- jQuery UI: 1.8.16
- datepicker: 0.9.8 (issue also in 0.9.7)