ilib
Version:
iLib is a cross-engine library of internationalization (i18n) classes written in pure JS
1 lines • 861 B
JavaScript
var MathUtils=require("./MathUtils.js"),Calendar=require("./Calendar.js"),PersianAlgoCal=function(options){this.type="persian-algo",options&&"function"==typeof options.onLoad&&options.onLoad(this)};PersianAlgoCal.monthLengths=[31,31,31,31,31,31,30,30,30,30,30,29],PersianAlgoCal.prototype.getNumMonths=function(year){return 12},PersianAlgoCal.prototype.getMonLength=function(month,year){return 12===month&&this.isLeapYear(year)?30:PersianAlgoCal.monthLengths[month-1]},PersianAlgoCal.prototype.equivalentCycleYear=function(year){var y=year-(0<=year?474:473);return MathUtils.mod(y,2820)+474},PersianAlgoCal.prototype.isLeapYear=function(year){return MathUtils.mod(682*(this.equivalentCycleYear(year)+38),2816)<682},PersianAlgoCal.prototype.getType=function(){return this.type},Calendar._constructors["persian-algo"]=PersianAlgoCal,module.exports=PersianAlgoCal;