Skip to content

Commit 953cd46

Browse files
Issue 644 - hasChanged uses strict comparisons so we need to ensure datatype
1 parent 2c1abab commit 953cd46

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

dist/jquery-ui-timepicker-addon.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -744,15 +744,22 @@
744744
microsec = parseInt(microsec, 10);
745745
}
746746
if (timezone !== false) {
747-
timezone = parseInt(timezone, 10);
747+
timezone = timezone.toString();
748748
}
749749

750750
var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
751751

752752
// If the update was done in the input field, the input field should not be updated.
753753
// If the update was done using the sliders, update the input field.
754-
var hasChanged = (hour !== this.hour || minute !== this.minute || second !== this.second || millisec !== this.millisec || microsec !== this.microsec ||
755-
(this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) || (this.timezone !== null && timezone !== this.timezone));
754+
var hasChanged = (
755+
hour !== parseInt(this.hour,10) ||
756+
minute !== parseInt(this.minute,10) ||
757+
second !== parseInt(this.second,10) ||
758+
millisec !== parseInt(this.millisec,10) ||
759+
microsec !== parseInt(this.microsec,10) ||
760+
(this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
761+
(this.timezone !== null && timezone !== this.timezone.toString())
762+
);
756763

757764
if (hasChanged) {
758765

0 commit comments

Comments
 (0)