[Lada-commits] [PATCH] Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Wald Commits
scm-commit at wald.intevation.org
Wed Mar 18 17:40:11 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426696865 -3600
# Node ID 195a253e9842a1899e4e9455e7fe66864be0a5db
# Parent e4419c5560e7ba20afa895c874c09eab651908d5
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
bigger than maxValue.
diff -r e4419c5560e7 -r 195a253e9842 app/view/widget/base/DateTimePicker.js
--- a/app/view/widget/base/DateTimePicker.js Wed Mar 18 15:45:15 2015 +0100
+++ b/app/view/widget/base/DateTimePicker.js Wed Mar 18 17:41:05 2015 +0100
@@ -98,6 +98,7 @@
ownerCt: me,
ownerLayout: me.getComponentLayout(),
value: 0,
+ maxValue: 23,
onSpinUp: function() {
var value = parseInt(this.getValue());
if (value === 23) {
@@ -134,6 +135,7 @@
ownerCt: me,
ownerLayout: me.getComponentLayout(),
value: 0,
+ maxValue: 59,
onSpinUp: function() {
var value = parseInt(this.getValue());
if (value === 59) {
@@ -214,7 +216,14 @@
me.callParent();
},
- changeTimeValue: function (field, nValue, oValue) {
+ changeTimeValue: function (field, nValue) {
+ var value = parseInt(nValue);
+ if (value > field.maxValue) {
+ field.setValue(field.maxValue);
+ }
+ else if (value < 10 && (nValue.indexOf('0') !== 0 || nValue.length < 2)) {
+ field.setValue('0' + nValue);
+ }
},
setValue: function(value) {
More information about the Lada-commits
mailing list