diff options
author | Kasun Chathuranga <chathuranga.jayaneththi@gmail.com> | 2013-05-14 22:27:29 +0530 |
---|---|---|
committer | Kasun Chathuranga <chathuranga.jayaneththi@gmail.com> | 2013-05-14 22:27:29 +0530 |
commit | e1b5ac77d22bb7b75292de076abe74fced7fb6db (patch) | |
tree | 5cd690ad185e733978fccbb595676709eac5a4d9 | |
parent | c9a909828977bd97aa9912ffe94338fb1717cb06 (diff) | |
download | jQuery-Timepicker-Addon-e1b5ac77d22bb7b75292de076abe74fced7fb6db.zip jQuery-Timepicker-Addon-e1b5ac77d22bb7b75292de076abe74fced7fb6db.tar.gz jQuery-Timepicker-Addon-e1b5ac77d22bb7b75292de076abe74fced7fb6db.tar.bz2 |
Correctly set microseconds when setting date and time
-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 |