ilib
Version:
iLib is a cross-engine library of internationalization (i18n) classes written in pure JS
1 lines • 868 B
JavaScript
var Utils=require("./Utils.js"),MathUtils=require("./MathUtils.js"),Calendar=require("./Calendar.js"),GregorianCal=function(options){options&&options.noinstance||(this.type="gregorian"),options&&"function"==typeof options.onLoad&&options.onLoad(this)};GregorianCal.monthLengths=[31,28,31,30,31,30,31,31,30,31,30,31],GregorianCal.prototype.getNumMonths=function(year){return 12},GregorianCal.prototype.getMonLength=function(month,year){return 2===month&&this.isLeapYear(year)?29:GregorianCal.monthLengths[month-1]},GregorianCal.prototype.isLeapYear=function(year){var year="number"==typeof year?year:year.getYears(),centuries=MathUtils.mod(year,400);return 0===MathUtils.mod(year,4)&&100!==centuries&&200!==centuries&&300!==centuries},GregorianCal.prototype.getType=function(){return this.type},Calendar._constructors.gregorian=GregorianCal,module.exports=GregorianCal;