From a13d0ca813e5591d46bbe607b6deec5ff97ec2db Mon Sep 17 00:00:00 2001 From: leon Date: Thu, 10 Aug 2023 17:19:47 +0800 Subject: [PATCH] set up time if empty --- Roo/bootstrap/form/TimeField.js | 4 ++-- roojs-bootstrap-debug.js | 4 ++-- roojs-bootstrap.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Roo/bootstrap/form/TimeField.js b/Roo/bootstrap/form/TimeField.js index 121f875b91..75bd32cef2 100644 --- a/Roo/bootstrap/form/TimeField.js +++ b/Roo/bootstrap/form/TimeField.js @@ -292,11 +292,11 @@ Roo.extend(Roo.bootstrap.form.TimeField, Roo.bootstrap.form.Input, { update: function() { // default minute is a multiple of minuteStep - if(typeof(this.time) === 'undefined') { + if(typeof(this.time) === 'undefined' || this.time.length == 0) { this.time = new Date(); this.time = this.time.add(Date.MINUTE, Math.round(parseInt(this.time.format('i')) / this.minuteStep) * this.minuteStep - parseInt(this.time.format('i'))); } - this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time; + this.time = (typeof(this.time) === 'undefined' || this.time.length == 0) ? new Date() : this.time; this.fill(); }, diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 2032bddf97..8efcc75073 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -24355,11 +24355,11 @@ Roo.extend(Roo.bootstrap.form.TimeField, Roo.bootstrap.form.Input, { update: function() { // default minute is a multiple of minuteStep - if(typeof(this.time) === 'undefined') { + if(typeof(this.time) === 'undefined' || this.time.length == 0) { this.time = new Date(); this.time = this.time.add(Date.MINUTE, Math.round(parseInt(this.time.format('i')) / this.minuteStep) * this.minuteStep - parseInt(this.time.format('i'))); } - this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time; + this.time = (typeof(this.time) === 'undefined' || this.time.length == 0) ? new Date() : this.time; this.fill(); }, diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 9633e33824..760dd67418 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1033,8 +1033,8 @@ break;case 38:this.onIncrementMinutes();break;case 40:this.onDecrementMinutes(); A.dom.innerHTML='';A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'i',cls:'hours-up fa fas fa-chevron-up'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'i',cls:'minutes-up fa fas fa-chevron-up'} ]}]},{tag:'td',cls:'separator'}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'span',cls:'timepicker-hour',html:'00'}]},{tag:'td',cls:'separator',html:':'},{tag:'td',cn:[{tag:'span',cls:'timepicker-minute',html:'00'}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'button',type:'button',cls:'btn btn-primary period',html:'AM'} ]}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-down fa fas fa-chevron-down'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down fa fas fa-chevron-down'} -]}]},{tag:'td',cls:'separator'}]});},update:function(){if(typeof(this.time)==='undefined'){this.time=new Date();this.time=this.time.add(Date.MINUTE,Math.round(parseInt(this.time.format('i'))/this.minuteStep)*this.minuteStep-parseInt(this.time.format('i'))); -}this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill();},fill:function(){var A=this.time.getHours();var B=this.time.getMinutes();var C=Roo.bootstrap.form.TimeField.periodText[this.language]['am'];if(A>11){C=Roo.bootstrap.form.TimeField.periodText[this.language]['pm']; +]}]},{tag:'td',cls:'separator'}]});},update:function(){if(typeof(this.time)==='undefined'||this.time.length==0){this.time=new Date();this.time=this.time.add(Date.MINUTE,Math.round(parseInt(this.time.format('i'))/this.minuteStep)*this.minuteStep-parseInt(this.time.format('i'))); +}this.time=(typeof(this.time)==='undefined'||this.time.length==0)?new Date():this.time;this.fill();},fill:function(){var A=this.time.getHours();var B=this.time.getMinutes();var C=Roo.bootstrap.form.TimeField.periodText[this.language]['am'];if(A>11){C=Roo.bootstrap.form.TimeField.periodText[this.language]['pm']; }if(A==0){A=12;}if(A>12){A=A-12;}if(A<10){A='0'+A;}if(B<10){B='0'+B;}this.pop.select('.timepicker-hour',true).first().dom.innerHTML=A;this.pop.select('.timepicker-minute',true).first().dom.innerHTML=B;this.pop.select('button',true).first().dom.innerHTML=C; },place:function(){this.picker().removeClass(['bottom-left','bottom-right','top-left','top-right']);var A=['bottom'];if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){A.pop(); A.push('top');}A.push('right');if((Roo.lib.Dom.getViewWidth()+Roo.get(document.body).getScroll().left)-(this.inputEl().getLeft()+this.picker().getWidth())<0){A.pop();A.push('left');}this.picker().addClass(A.join('-'));var B=this;Roo.each(A,function(c){if(c=='bottom'){(function(){} -- 2.39.2