app/assets/javascripts/will_pickdate.js in will_pickdate-0.9.4 vs app/assets/javascripts/will_pickdate.js in will_pickdate-0.9.5
- old
+ new
@@ -420,11 +420,11 @@
if(this.options.militaryTime) {
if(dy > 0) {
v = (v < 23) ? v + 1 : 0;
}
else if(dy < 0) {
- v = (v > 0) ? v - 1 : 23;
+ v = (v > 0) ? Math.min(v - 1, 23) : 23;
}
}
else {
var ampm = this.picker.find('.ampm');
if(dy > 0) {
@@ -443,11 +443,11 @@
if(v == 12) {
v = 11;
ampm.val(ampm.val() == 'AM' ? 'PM' : 'AM');
}
else if(v > 1) {
- v--;
+ v = Math.min(v - 1, 12);
}
else {
v = 12;
}
}
@@ -492,11 +492,12 @@
} else if (event.which == 40) {
//down arrow
dy = -1;
} else if (48 <= event.which && event.which <= 57) {
event.target.value = (event.target.value + String.fromCharCode(event.which)).substr(1,2)
- } else if (event.which == 9 ) {
+ } else if (event.which == 9 || event.which == 46 || event.which == 8) {
//allow tab to skip to next
+ //allow delete and backspace to have normal behaviour
return;
}
$.proxy(f, this)(event, null, null, dy);
},
\ No newline at end of file