From ddb2c3ce2c177510d52e05225c35c34b532b6e85 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 11 Feb 2021 14:08:32 +0800 Subject: [PATCH] empty initial date causes error --- Roo/bootstrap/DateField.js | 4 ++-- docs/src/Roo_bootstrap_Popover.js.html | 2 +- roojs-bootstrap-debug.js | 2 +- roojs-bootstrap.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Roo/bootstrap/DateField.js b/Roo/bootstrap/DateField.js index 86f4a2acee..2a695098f3 100644 --- a/Roo/bootstrap/DateField.js +++ b/Roo/bootstrap/DateField.js @@ -751,8 +751,8 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { //Roo.log(className); if (className.indexOf('day') > -1 && className.indexOf('disabled') < 0 ){ var day = parseInt(html, 10) || 1; - var year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(); + var year = (new Date(this.viewDate)).getUTCFullYear(), + month = (new Date(this.viewDate)).getUTCMonth(); if (className.indexOf('old') > -1) { if(month === 0 ){ diff --git a/docs/src/Roo_bootstrap_Popover.js.html b/docs/src/Roo_bootstrap_Popover.js.html index 1f9fd5131f..c8a7e2f9c0 100644 --- a/docs/src/Roo_bootstrap_Popover.js.html +++ b/docs/src/Roo_bootstrap_Popover.js.html @@ -281,7 +281,7 @@ } - this.alignEl = on_el; + this.alignEl = Roo.get( on_el ); if (!this.el) { this.render(document.body); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 92cdce6707..fd393c2bc8 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -19877,7 +19877,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, { } - this.alignEl = on_el; + this.alignEl = Roo.get( on_el ); if (!this.el) { this.render(document.body); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index d38e0d6a40..d6eb9fd05b 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -819,7 +819,7 @@ this.headerEl.setVisibilityMode(Roo.Element.DISPLAY);this.el.enableDisplayMode(' var B=this.trigger?this.trigger.split(' '):[];Roo.each(B,function(C){if(C=='click'){A.on('click',this.toggle,this);}else if(C!='manual'){var D=C=='hover'?'mouseenter':'focusin';var E=C=='hover'?'mouseleave':'focusout';A.on(D,this.enter,this);A.on(E,this.leave,this); }},this);},timeout:null,hoverState:null,toggle:function(){this.hoverState=='in'?this.leave():this.enter();},enter:function(){clearTimeout(this.timeout);this.hoverState='in';if(!this.delay||!this.delay.show){this.show();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='in'){_t.show(); }},this.delay.show)},leave:function(){clearTimeout(this.timeout);this.hoverState='out';if(!this.delay||!this.delay.hide){this.hide();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='out'){_t.hide();}},this.delay.hide)},show:function(A,B){this.placement=typeof(B)=='undefined'?this.placement:B; -A=A||false;if(!A){if(this.parent()&&(this.over=='parent'||(this.over===false))){A=this.parent().el;}else if(this.over){Roo.get(this.over);}}this.alignEl=A;if(!this.el){this.render(document.body);}if(this.title===false){this.headerEl.hide();}this.el.show(); +A=A||false;if(!A){if(this.parent()&&(this.over=='parent'||(this.over===false))){A=this.parent().el;}else if(this.over){Roo.get(this.over);}}this.alignEl=Roo.get(A);if(!this.el){this.render(document.body);}if(this.title===false){this.headerEl.hide();}this.el.show(); this.el.dom.style.display='block';if(this.alignEl){this.updatePosition(this.placement,true);}else{var es=this.el.getSize();var x=Roo.lib.Dom.getViewWidth()/2;var y=Roo.lib.Dom.getViewHeight()/2;this.el.setXY([x-(es.width/2),y-(es.height/2)]);}this.el.addClass('in'); this.hoverState='in';if(this.modal){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.setStyle('z-index',Roo.bootstrap.Popover.zIndex++);this.maskEl.dom.style.display='block';this.maskEl.addClass('show');}this.el.setStyle('z-index',Roo.bootstrap.Popover.zIndex++); this.fireEvent('show',this);},updatePosition:function(A,B){A=A?A:this.placement;B=typeof(B)=='undefined'?true:B;this.el.removeClass(['fade','top','bottom','left','right','in','bs-popover-top','bs-popover-bottom','bs-popover-left','bs-popover-right']);this.el.addClass(A+' bs-popover-'+A); -- 2.39.2