summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasun Chathuranga <chathuranga.jayaneththi@gmail.com>2013-05-14 22:27:29 +0530
committerKasun Chathuranga <chathuranga.jayaneththi@gmail.com>2013-05-14 22:27:29 +0530
commite1b5ac77d22bb7b75292de076abe74fced7fb6db (patch)
tree5cd690ad185e733978fccbb595676709eac5a4d9
parentc9a909828977bd97aa9912ffe94338fb1717cb06 (diff)
downloadjQuery-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.js11
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