UNPKG

ilib

Version:

iLib is a cross-engine library of internationalization (i18n) classes written in pure JS

1 lines 879 B
var Calendar=require("./Calendar.js"),PersRataDie=require("./PersRataDie.js"),PersianCal=function(options){this.type="persian",options&&"function"==typeof options.onLoad&&options.onLoad(this)};PersianCal.monthLengths=[31,31,31,31,31,31,30,30,30,30,30,29],PersianCal.prototype.getNumMonths=function(year){return 12},PersianCal.prototype.getMonLength=function(month,year){return 12===month&&this.isLeapYear(year)?30:PersianCal.monthLengths[month-1]},PersianCal.prototype.isLeapYear=function(year){var rdNextYear=new PersRataDie({cal:this,year:year+1,month:1,day:1,hour:0,minute:0,second:0,millisecond:0}),year=new PersRataDie({cal:this,year:year,month:1,day:1,hour:0,minute:0,second:0,millisecond:0});return 365<rdNextYear.getRataDie()-year.getRataDie()},PersianCal.prototype.getType=function(){return this.type},Calendar._constructors.persian=PersianCal,module.exports=PersianCal;