trentrichardson/jQuery-Timepicker-Addon — Issue #265: setDate ignores AM/PM somehow
Author: deGir
Created: 2011-10-20 09:56:59+00:00
State: open

Hi,

I'm currently using your lib in a project which requires the user to define a starttime (picker-a) and an endtime (picker-b). Due to multilingual features built into our project the datetimepicker needs to display various dateformats. Those pickers are basically input fields and get triggerd by icon-click. Inline editing is disabled.

It seems to me that either setDate is broken - or I'm just too confused or stupid - when it comes to the AM/PM-thingy.

I take the value from the first picker and want to add one single day, but leave the time as is. This already works - no rocket science. As setDate requires a Date-Object I instantiate it...

This is the Date-Object as outputted via console:

Date {Thu Dec 01 2011 13:00:00 GMT+0100}

In your lib where you are overwriting 'setDate' the following string is inbound:

Thu Dec 01 2011 13:00:00 GMT+0100

So, for me it seems correct up to here. Anyhow, when I use (*** is the Dateobject.):

$('#picker-b').datetimepicker('setDate', endDate*** );

it sets:

12/01/2011 01:00 am

Whereby in Picker-A the actual value is:

12/01/2011 01:00 pm

So the problem is that it seems to ignore AM and PM when 'setDate' is used.

Both pickers have the flag 'ampm: true', the dateformat is 'mm/dd/yy' and the timeformat 'hh:mm tt'.

Is this a bug, or did I miss something to get it working properly?! Any help or hint is appreciated.

Best regards.