Roo/bootstrap/form/DateField.js
authorleon <leon@roojs.com>
Thu, 10 Aug 2023 03:41:46 +0000 (11:41 +0800)
committerleon <leon@roojs.com>
Thu, 10 Aug 2023 03:41:46 +0000 (11:41 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/form/DateField.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 5a25358..6a5e573 100644 (file)
@@ -257,6 +257,8 @@ Roo.extend(Roo.bootstrap.form.DateField, Roo.bootstrap.form.Input,  {
         }
         
         Roo.each(this.picker().select('tfoot th.today', true).elements, function(v){
+            Roo.log('ELEMENT');
+            Roo.log(v);
             if(!this.calendarWeeks){
                 v.remove();
                 return;
index 0b07d0d..3d1d1f4 100644 (file)
@@ -23041,9 +23041,6 @@ Roo.extend(Roo.bootstrap.form.DateField, Roo.bootstrap.form.Input,  {
         Roo.bootstrap.form.DateField.superclass.onRender.call(this, ct, position);
 
         this.translateDates(this.language);
-
-        Roo.log(Roo.bootstrap.form.DateField.dates);
-        Roo.log(Roo.bootstrap.form.DateField.todayText);
         
         this.isRTL = Roo.bootstrap.form.DateField.dates[this.language].rtl || false;
         this.format = this.format || 'm/d/y';
@@ -23106,12 +23103,14 @@ Roo.extend(Roo.bootstrap.form.DateField, Roo.bootstrap.form.Input,  {
         }
         
         Roo.each(this.picker().select('tfoot th.today', true).elements, function(v){
+            Roo.log('ELEMENT');
+            Roo.log(v);
             if(!this.calendarWeeks){
                 v.remove();
                 return;
             }
             
-            v.dom.innerHTML = Roo.bootstrap.form.DateField.dates[this.language].today;
+            v.dom.innerHTML = Roo.bootstrap.form.DateField.todayText;
             v.attr('colspan', function(i, val){
                 return parseInt(val) + 1;
             });
index 0fc962b..bc2891e 100644 (file)
@@ -968,15 +968,15 @@ Roo.bootstrap.form.DateField=function(A){Roo.bootstrap.form.DateField.superclass
 },setDate:function(d){this.setUTCDate(new Date(d.getTime()-(d.getTimezoneOffset()*60000)));},setUTCDate:function(d){this.date=d;this.setValue(this.date);},translateDates:function(A){var B=Roo.bootstrap.form.DateField.dates[A]={days:[],daysShort:[],daysMin:[],months:[],monthsShort:[]}
 ;var C=A.replace('_','-');var D=new RegExp('^[A-Za-z]+$');for(var i=0;i<7;i++){var E=new Date(2020,0,5+i);var F=new Intl.DateTimeFormat(C,{weekday:'long'}).format(E);var G=new Intl.DateTimeFormat(C,{weekday:'short'}).format(E);var H=new Intl.DateTimeFormat(C,{weekday:'narrow'}
 ).format(E);if(D.test(F)){G=F.substring(0,3);H=F.substring(0,2);}B['days'].push(F);B['daysShort'].push(G);B['daysMin'].push(H);}for(var i=0;i<12;i++){var E=new Date(2020,i);var I=new Intl.DateTimeFormat(C,{month:'long'}).format(E);var J=new Intl.DateTimeFormat(C,{month:'short'}
-).format(E);if(D.test(I)){J=I.substring(0,3);}B['months'].push(I);B['monthsShort'].push(J);}},onRender:function(ct,A){Roo.bootstrap.form.DateField.superclass.onRender.call(this,ct,A);this.translateDates(this.language);Roo.log(Roo.bootstrap.form.DateField.dates);
-Roo.log(Roo.bootstrap.form.DateField.todayText);this.isRTL=Roo.bootstrap.form.DateField.dates[this.language].rtl||false;this.format=this.format||'m/d/y';this.isInline=false;this.isInput=true;this.component=this.el.select('.add-on',true).first()||false;this.component=(this.component&&this.component.length===0)?false:this.component;
-this.hasInput=this.component&&this.inputEl().length;if(typeof(this.minViewMode==='string')){switch(this.minViewMode){case 'months':this.minViewMode=1;break;case 'years':this.minViewMode=2;break;default:this.minViewMode=0;break;}}if(typeof(this.viewMode==='string')){switch(this.viewMode){case 'months':this.viewMode=1;
+).format(E);if(D.test(I)){J=I.substring(0,3);}B['months'].push(I);B['monthsShort'].push(J);}},onRender:function(ct,A){Roo.bootstrap.form.DateField.superclass.onRender.call(this,ct,A);this.translateDates(this.language);this.isRTL=Roo.bootstrap.form.DateField.dates[this.language].rtl||false;
+this.format=this.format||'m/d/y';this.isInline=false;this.isInput=true;this.component=this.el.select('.add-on',true).first()||false;this.component=(this.component&&this.component.length===0)?false:this.component;this.hasInput=this.component&&this.inputEl().length;
+if(typeof(this.minViewMode==='string')){switch(this.minViewMode){case 'months':this.minViewMode=1;break;case 'years':this.minViewMode=2;break;default:this.minViewMode=0;break;}}if(typeof(this.viewMode==='string')){switch(this.viewMode){case 'months':this.viewMode=1;
 break;case 'years':this.viewMode=2;break;default:this.viewMode=0;break;}}this.pickerEl=Roo.get(document.body).createChild(Roo.bootstrap.form.DateField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);
 this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');this.startViewMode=this.viewMode;if(this.singleMode){Roo.each(this.picker().select('thead > tr > th',true).elements,function(v){v.setVisibilityMode(Roo.Element.DISPLAY);
-v.hide();});Roo.each(this.picker().select('tbody > tr > td',true).elements,function(v){v.setStyle('width','189px');});}Roo.each(this.picker().select('tfoot th.today',true).elements,function(v){if(!this.calendarWeeks){v.remove();return;}v.dom.innerHTML=Roo.bootstrap.form.DateField.dates[this.language].today;
-v.attr('colspan',function(i,B){return parseInt(B)+1;});});this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(this.startDate);this.setEndDate(this.endDate);this.setDaysOfWeekDisabled(this.daysOfWeekDisabled);this.fillDow();this.fillMonths();
-this.update();this.showMode();if(this.isInline){this.showPopup();}this.hiddenField=this.inputEl().insertSibling({tag:'input',type:'hidden',name:this.name},'before',true);this.inputEl().dom.setAttribute('name',this.name+'____hidden___');},picker:function(){return this.pickerEl;
-},fillDow:function(){var A=this.weekStart;var B={tag:'tr',cn:[]};if(this.calendarWeeks){B.cn.push({tag:'th',cls:'cw',html:'&nbsp;'})}while(A<this.weekStart+7){B.cn.push({tag:'th',cls:'dow',html:Roo.bootstrap.form.DateField.dates[this.language].daysMin[(A++)%7]}
+v.hide();});Roo.each(this.picker().select('tbody > tr > td',true).elements,function(v){v.setStyle('width','189px');});}Roo.each(this.picker().select('tfoot th.today',true).elements,function(v){Roo.log('ELEMENT');Roo.log(v);if(!this.calendarWeeks){v.remove();
+return;}v.dom.innerHTML=Roo.bootstrap.form.DateField.todayText;v.attr('colspan',function(i,B){return parseInt(B)+1;});});this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(this.startDate);this.setEndDate(this.endDate);this.setDaysOfWeekDisabled(this.daysOfWeekDisabled);
+this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.showPopup();}this.hiddenField=this.inputEl().insertSibling({tag:'input',type:'hidden',name:this.name},'before',true);this.inputEl().dom.setAttribute('name',this.name+'____hidden___');
+},picker:function(){return this.pickerEl;},fillDow:function(){var A=this.weekStart;var B={tag:'tr',cn:[]};if(this.calendarWeeks){B.cn.push({tag:'th',cls:'cw',html:'&nbsp;'})}while(A<this.weekStart+7){B.cn.push({tag:'th',cls:'dow',html:Roo.bootstrap.form.DateField.dates[this.language].daysMin[(A++)%7]}
 );}this.picker().select('>.datepicker-days thead',true).first().createChild(B);},fillMonths:function(){var i=0;var A=this.picker().select('>.datepicker-months td',true).first();A.dom.innerHTML='';while(i<12){var B={tag:'span',cls:'month',html:Roo.bootstrap.form.DateField.dates[this.language].monthsShort[i++]}
 ;A.createChild(B);}},update:function(){this.date=(typeof(this.date)==='undefined'||((typeof(this.date)==='string')&&!this.date.length))?this.UTCToday():(typeof(this.date)==='string')?this.parseDate(this.date):this.date;if(this.date<this.startDate){this.viewDate=new Date(this.startDate);
 }else if(this.date>this.endDate){this.viewDate=new Date(this.endDate);}else{this.viewDate=new Date(this.date);}this.fill();},fill:function(){var d=new Date(this.viewDate),A=d.getUTCFullYear(),B=d.getUTCMonth(),C=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,D=this.startDate!==-Infinity?this.startDate.getUTCMonth():-Infinity,E=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,F=this.endDate!==Infinity?this.endDate.getUTCMonth():Infinity,G=this.date&&this.date.valueOf(),H=this.UTCToday();