UNPKG

@iro/calendar

Version:

lunar is a calendar library for Solar and Chinese Lunar.

47 lines 1.53 kB
import { LunarUtil } from './LunarUtil'; import { LiuYue } from './LiuYue'; var LiuNian = (function () { function LiuNian(daYun, index) { this._year = daYun.getStartYear() + index; this._age = daYun.getStartAge() + index; this._index = index; this._daYun = daYun; this._lunar = daYun.getLunar(); } LiuNian.prototype.getYear = function () { return this._year; }; LiuNian.prototype.getAge = function () { return this._age; }; LiuNian.prototype.getIndex = function () { return this._index; }; LiuNian.prototype.getLunar = function () { return this._lunar; }; LiuNian.prototype.getGanZhi = function () { var offset = LunarUtil.getJiaZiIndex(this._lunar.getJieQiTable().get('立春').getLunar().getYearInGanZhiExact()) + this._index; if (this._daYun.getIndex() > 0) { offset += this._daYun.getStartAge() - 1; } offset %= LunarUtil.JIA_ZI.length; return LunarUtil.JIA_ZI[offset]; }; LiuNian.prototype.getXun = function () { return LunarUtil.getXun(this.getGanZhi()); }; LiuNian.prototype.getXunKong = function () { return LunarUtil.getXunKong(this.getGanZhi()); }; LiuNian.prototype.getLiuYue = function () { var l = []; for (var i = 0; i < 12; i++) { l.push(new LiuYue(this, i)); } return l; }; return LiuNian; }()); export { LiuNian }; //# sourceMappingURL=LiuNian.js.map