ilib
Version:
iLib is a cross-engine library of internationalization (i18n) classes written in pure JS
1 lines • 1.66 kB
JavaScript
var ilib=require("./ilib.js"),JSUtils=require("./JSUtils.js"),IDate=require("./IDate.js"),ThaiSolarCal=require("./ThaiSolarCal.js"),GregorianDate=require("./GregorianDate.js"),ThaiSolarDate=function(params){var p={};params&&(JSUtils.shallowCopy(params,p),void 0!==p.year&&(p.year-=543),void 0!==p.rd&&(p.rd-=198327)),this.rd=null,this.offset=void 0,p.onLoad=ilib.bind(this,function(gd){this.cal=new ThaiSolarCal(),params&&void 0!==params.year&&(this.year=parseInt(params.year,10)),params&&"function"==typeof params.onLoad&¶ms.onLoad(gd)}),GregorianDate.call(this,p)};ThaiSolarDate.prototype=new GregorianDate({noinstance:!0}),ThaiSolarDate.prototype.parent=GregorianDate.prototype,(ThaiSolarDate.prototype.constructor=ThaiSolarDate).epoch=1523097.5,ThaiSolarDate.prototype._calcDateComponents=function(){this.parent._calcDateComponents.call(this),this.year+=543},ThaiSolarDate.prototype.getRataDie=function(){return this.rd.getRataDie()+198327},ThaiSolarDate.prototype.before=function(dow){return new ThaiSolarDate({rd:this.rd.before(dow,this.offset)+198327,timezone:this.timezone})},ThaiSolarDate.prototype.after=function(dow){return new ThaiSolarDate({rd:this.rd.after(dow,this.offset)+198327,timezone:this.timezone})},ThaiSolarDate.prototype.onOrBefore=function(dow){return new ThaiSolarDate({rd:this.rd.onOrBefore(dow,this.offset)+198327,timezone:this.timezone})},ThaiSolarDate.prototype.onOrAfter=function(dow){return new ThaiSolarDate({rd:this.rd.onOrAfter(dow,this.offset)+198327,timezone:this.timezone})},ThaiSolarDate.prototype.getCalendar=function(){return"thaisolar"},IDate._constructors.thaisolar=ThaiSolarDate,module.exports=ThaiSolarDate;