Added change by mikedeco in _onTimeChange. Assures that hour, minute, second is numeric

This commit is contained in:
Trent Richardson 2010-12-22 09:29:49 -05:00
parent 3d53741ca4
commit 895d27f1de

View file

@ -524,9 +524,14 @@ $.extend(Timepicker.prototype, {
_onTimeChange: function() { _onTimeChange: function() {
var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false, var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
minute = (this.minute_slider) ? this.minute_slider.slider('value') : false, minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
second = (this.second_slider) ? this.second_slider.slider('value') : false, second = (this.second_slider) ? this.second_slider.slider('value') : false;
ampm = (hour < 12) ? 'AM' : 'PM';
if (hour) hour = parseFloat(hour).toFixed(0);
if (minute) minute = parseFloat(minute).toFixed(0);
if (second) second = parseFloat(second).toFixed(0);
var ampm = (hour < 12) ? 'AM' : 'PM';
// If the update was done in the input field, the input field should not be updated. // If the update was done in the input field, the input field should not be updated.
// If the update was done using the sliders, update the input field. // If the update was done using the sliders, update the input field.
var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || (this.ampm.length > 0 && this.ampm != ampm)); var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || (this.ampm.length > 0 && this.ampm != ampm));