ethiopic-js
Version:
Converts Ethiopian calendar dates into Gregorian and vice versa.
173 lines (125 loc) • 6.27 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var BaseCalendar = exports.BaseCalendar = function () {
function BaseCalendar(jdn) {
_classCallCheck(this, BaseCalendar);
this.jdn = jdn;
}
_createClass(BaseCalendar, [{
key: "getJdn",
value: function getJdn() {
return this.jdn;
}
}]);
return BaseCalendar;
}();
var MonthCalendar = exports.MonthCalendar = function (_BaseCalendar) {
_inherits(MonthCalendar, _BaseCalendar);
function MonthCalendar(jdn, month, day) {
_classCallCheck(this, MonthCalendar);
var _this = _possibleConstructorReturn(this, (MonthCalendar.__proto__ || Object.getPrototypeOf(MonthCalendar)).call(this, jdn));
_this.month = month;
_this.day = day;
return _this;
}
_createClass(MonthCalendar, [{
key: "getMonth",
value: function getMonth() {
return this.month;
}
}, {
key: "getDay",
value: function getDay() {
return this.day;
}
}]);
return MonthCalendar;
}(BaseCalendar);
var YearCalendar = exports.YearCalendar = function (_BaseCalendar2) {
_inherits(YearCalendar, _BaseCalendar2);
function YearCalendar(jdn, year) {
_classCallCheck(this, YearCalendar);
var _this2 = _possibleConstructorReturn(this, (YearCalendar.__proto__ || Object.getPrototypeOf(YearCalendar)).call(this, jdn));
_this2.year = year;
return _this2;
}
_createClass(YearCalendar, [{
key: "getYear",
value: function getYear() {
return this.year;
}
}]);
return YearCalendar;
}(BaseCalendar);
var YearMonthCalendar = exports.YearMonthCalendar = function (_MonthCalendar) {
_inherits(YearMonthCalendar, _MonthCalendar);
function YearMonthCalendar(jdn, year, month, day) {
_classCallCheck(this, YearMonthCalendar);
var _this3 = _possibleConstructorReturn(this, (YearMonthCalendar.__proto__ || Object.getPrototypeOf(YearMonthCalendar)).call(this, jdn, month, day));
_this3.year = year;
return _this3;
}
return YearMonthCalendar;
}(MonthCalendar);
var LeapCalendar = exports.LeapCalendar = function (_YearMonthCalendar) {
_inherits(LeapCalendar, _YearMonthCalendar);
function LeapCalendar(jdn, year, month, day, yearLeap) {
_classCallCheck(this, LeapCalendar);
var _this4 = _possibleConstructorReturn(this, (LeapCalendar.__proto__ || Object.getPrototypeOf(LeapCalendar)).call(this, jdn, year, month, day));
_this4.yearLeap = yearLeap;
return _this4;
}
_createClass(LeapCalendar, [{
key: "isYearLeap",
value: function isYearLeap() {
return this.yearLeap;
}
}]);
return LeapCalendar;
}(YearMonthCalendar);
var LeapMonthCalendar = exports.LeapMonthCalendar = function (_YearMonthCalendar2) {
_inherits(LeapMonthCalendar, _YearMonthCalendar2);
function LeapMonthCalendar(jdn, year, month, day, monthLeap) {
_classCallCheck(this, LeapMonthCalendar);
var _this5 = _possibleConstructorReturn(this, (LeapMonthCalendar.__proto__ || Object.getPrototypeOf(LeapMonthCalendar)).call(this, jdn, year, month, day));
_this5.monthLeap = monthLeap;
return _this5;
}
_createClass(LeapMonthCalendar, [{
key: "isMonthLeap",
value: function isMonthLeap() {
return this.monthLeap;
}
}]);
return LeapMonthCalendar;
}(YearMonthCalendar);
var LeapDayMonthCalendar = exports.LeapDayMonthCalendar = function (_LeapMonthCalendar) {
_inherits(LeapDayMonthCalendar, _LeapMonthCalendar);
function LeapDayMonthCalendar(jdn, year, month, day, monthLeap, dayLeap) {
_classCallCheck(this, LeapDayMonthCalendar);
var _this6 = _possibleConstructorReturn(this, (LeapDayMonthCalendar.__proto__ || Object.getPrototypeOf(LeapDayMonthCalendar)).call(this, jdn, year, month, day, monthLeap));
_this6.dayLeap = dayLeap;
return _this6;
}
_createClass(LeapDayMonthCalendar, [{
key: "isDayLeap",
value: function isDayLeap() {
return this.dayLeap;
}
}]);
return LeapDayMonthCalendar;
}(LeapMonthCalendar);
var CalendarValidationException = exports.CalendarValidationException = function (_Error) {
_inherits(CalendarValidationException, _Error);
function CalendarValidationException(error) {
_classCallCheck(this, CalendarValidationException);
return _possibleConstructorReturn(this, (CalendarValidationException.__proto__ || Object.getPrototypeOf(CalendarValidationException)).call(this, error));
}
return CalendarValidationException;
}(Error);