diff options
-rw-r--r-- | jquery-ui-timepicker-addon.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 12b7f77..e5da424 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -1546,6 +1546,7 @@ tp_date.setMicroseconds(tp_inst.microsec); } else { tp_date = new Date(date.getTime()); + tp_date.setMicroseconds(date.getMicroseconds()); } if (tp_date.toString() == 'Invalid Date') { tp_date = undefined; @@ -1573,8 +1574,14 @@ } } - var tp_inst = this._get(inst, 'timepicker'), - tp_date = (date instanceof Date) ? new Date(date.getTime()) : date; + var tp_inst = this._get(inst, 'timepicker'); + var tp_date; + if (date instanceof Date) { + tp_date = new Date(date.getTime()); + tp_date.setMicroseconds(date.getMicroseconds()); + } else { + tp_date = date; + } // This is important if you are using the timezone option, javascript's Date // object will only return the timezone offset for the current locale, so we |