Opened 11 years ago

Last modified 10 years ago

#9212 closed enhancement

thai buddhist calendar — at Initial Version

Reported by: KuRoz Owned by:
Priority: high Milestone: 1.4
Component: Dojox Version: 1.3.0
Keywords: thai buddhist calendar Cc: natta@…
Blocked By: Blocking:

Description

I've modified part of _DateTimeTextBox.js to make it capable of Thai Buddhist calendar. (You have to add dojo.require("dojo.cldr.supplemental"); to all of modified class)

onValueSelected:function(_d){ if(_b._tabbingAway){ delete _b._tabbingAway; }else{ _b.focus(); } setTimeout(dojo.hitch(_b,"_close"),1); dijit.form._DateTimeTextBox.superclass._setValueAttr2.call(_b,_d,true);

_getDisplayedValueAttr:function(){ if(dojo.cldr.supplemental._region(this.lang)=="th"){ var temp1=this.textbox.value; var temp2=this.textbox.value; temp1=parseInt(temp1.substring(temp1.lastIndexOf('/')+1))-543; temp2=temp2.substring(0,temp2.lastIndexOf('/')+1); return temp2+temp1; } return this.textbox.value; }

And modified part of TextBox?.js (add _setValueAttr2 function)

_setValueAttr2:function(_1,_2,_3){ var _4; if(_1!==undefined){ _4=this.filter(_1); if(typeof _3!="string"){

if(_4!==null&&((typeof _4!="number")
!isNaN(_4))){

_3=this.filter(this.format(_4,this.constraints)); if(dojo.cldr.supplemental._region(this.lang)=="th"){ var temp1=_3; var temp2=_3; temp1=parseInt(temp1.substring(temp1.lastIndexOf('/')+1))+543; temp2=temp2.substring(0,temp2.lastIndexOf('/')+1); _3=temp2+temp1; } }else{ _3=""; } } }

if(_3!=null&&_3!=undefined&&((typeof _3)!="number"
!isNaN(_3))&&this.textbox.value!=_3){

this.textbox.value=_3; } this.inherited(arguments,[_4,_2]); }

_setBlurValue:function(){ this._setValueAttr2(this.attr("value"),true); }

And modified part of _Calendar.js

var _14=dojo.date.locale.getNames("months","wide","standAlone",this.lang); this._setText(this.monthLabelNode,_14[_5.getMonth()]); var y=_5.getFullYear()-1; if(dojo.cldr.supplemental._region(this.lang)=="th"){ y+=543;} var d=new Date(); dojo.forEach(["previous","current","next"],function(_17){ d.setFullYear(y++); this._setText(this[_17+"YearLabelNode?"],dojo.date.locale.format(d,{selector:"year",locale:this.lang})); },this);

var _23=dojo.date.locale.getNames("days",this.dayWidth,"standAlone",this.lang); if(dojo.cldr.supplemental._region(this.lang)=="th"){ _23=dojo.date.locale.getNames("days","abbr","standAlone",this.lang); }

And modified part of supplemental.js of dojo

dojo.cldr.supplemental._region=function(_5){ _5=dojo.i18n.normalizeLocale(_5); var _6=_5.split("-"); var _7=_6[1]; if(!_7){ _7={de:"de",en:"us",es:"es",fi:"fi",fr:"fr",he:"il",hu:"hu",it:"it",ja:"jp",ko:"kr",nl:"nl",pt:"br",sv:"se",zh:"cn",th:"th"}[_6[0]]; }else{ if(_7.length==4){ _7=_6[2]; } } return _7; };

Change History (0)

Note: See TracTickets for help on using tickets.