UNPKG

@iro/calendar

Version:

lunar is a calendar library for Solar and Chinese Lunar.

43 lines 1.38 kB
import { LunarUtil } from './LunarUtil'; var XiaoYun = (function () { function XiaoYun(daYun, index, forward) { this._year = daYun.getStartYear() + index; this._age = daYun.getStartAge() + index; this._index = index; this._daYun = daYun; this._lunar = daYun.getLunar(); this._forward = forward; } XiaoYun.prototype.getYear = function () { return this._year; }; XiaoYun.prototype.getAge = function () { return this._age; }; XiaoYun.prototype.getIndex = function () { return this._index; }; XiaoYun.prototype.getGanZhi = function () { var offset = LunarUtil.getJiaZiIndex(this._lunar.getTimeInGanZhi()); var add = this._index + 1; if (this._daYun.getIndex() > 0) { add += this._daYun.getStartAge() - 1; } offset += this._forward ? add : -add; var size = LunarUtil.JIA_ZI.length; while (offset < 0) { offset += size; } offset %= size; return LunarUtil.JIA_ZI[offset]; }; XiaoYun.prototype.getXun = function () { return LunarUtil.getXun(this.getGanZhi()); }; XiaoYun.prototype.getXunKong = function () { return LunarUtil.getXunKong(this.getGanZhi()); }; return XiaoYun; }()); export { XiaoYun }; //# sourceMappingURL=XiaoYun.js.map