@iro/calendar
Version:
lunar is a calendar library for Solar and Chinese Lunar.
1,342 lines (1,341 loc) • 57.3 kB
JavaScript
import { Solar } from './Solar';
import { SolarUtil } from './SolarUtil';
import { LunarUtil } from './LunarUtil';
import { JieQi } from './JieQi';
import { EightChar } from './EightChar';
import { NineStar } from './NineStar';
import { Dictionary } from './Dictionary';
import { ShuJiu } from './ShuJiu';
import { Fu } from './Fu';
import { LunarYear } from './LunarYear';
import { LunarTime } from './LunarTime';
import { Foto } from './Foto';
import { Tao } from './Tao';
var Lunar = (function () {
function Lunar(year, month, day, hour, minute, second, solar, ly) {
var info = Lunar._compute(year, hour, minute, solar, ly);
this._year = year;
this._month = month;
this._day = day;
this._hour = hour;
this._minute = minute;
this._second = second;
this._timeGanIndex = info.timeGanIndex;
this._timeZhiIndex = info.timeZhiIndex;
this._dayGanIndex = info.dayGanIndex;
this._dayZhiIndex = info.dayZhiIndex;
this._dayGanIndexExact = info.dayGanIndexExact;
this._dayZhiIndexExact = info.dayZhiIndexExact;
this._dayGanIndexExact2 = info.dayGanIndexExact2;
this._dayZhiIndexExact2 = info.dayZhiIndexExact2;
this._monthGanIndex = info.monthGanIndex;
this._monthZhiIndex = info.monthZhiIndex;
this._monthGanIndexExact = info.monthGanIndexExact;
this._monthZhiIndexExact = info.monthZhiIndexExact;
this._yearGanIndex = info.yearGanIndex;
this._yearZhiIndex = info.yearZhiIndex;
this._yearGanIndexByLiChun = info.yearGanIndexByLiChun;
this._yearZhiIndexByLiChun = info.yearZhiIndexByLiChun;
this._yearGanIndexExact = info.yearGanIndexExact;
this._yearZhiIndexExact = info.yearZhiIndexExact;
this._weekIndex = info.weekIndex;
this._jieQi = info.jieQi;
this._jieQiList = info.jieQiList;
this._solar = solar;
this._eightChar = new EightChar(this);
}
Lunar.fromYmd = function (lunarYear, lunarMonth, lunarDay) {
return Lunar.fromYmdHms(lunarYear, lunarMonth, lunarDay, 0, 0, 0);
};
Lunar.fromYmdHms = function (lunarYear, lunarMonth, lunarDay, hour, minute, second) {
var y = LunarYear.fromYear(lunarYear);
var m = y.getMonth(lunarMonth);
if (null == m) {
throw new Error("wrong lunar year ".concat(lunarYear, " month ").concat(lunarMonth));
}
if (lunarDay < 1) {
throw new Error('lunar day must bigger than 0');
}
var days = m.getDayCount();
if (lunarDay > days) {
throw new Error("only ".concat(days, " days in lunar year ").concat(lunarYear, " month ").concat(lunarMonth));
}
var noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1);
var solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second);
if (noon.getYear() !== lunarYear) {
y = LunarYear.fromYear(noon.getYear());
}
return new Lunar(lunarYear, lunarMonth, lunarDay, hour, minute, second, solar, y);
};
Lunar.fromSolar = function (solar) {
var lunarYear = 0;
var lunarMonth = 0;
var lunarDay = 0;
var ly = LunarYear.fromYear(solar.getYear());
var lms = ly.getMonths();
for (var i = 0, j = lms.length; i < j; i++) {
var m = lms[i];
var firstDay = Solar.fromJulianDay(m.getFirstJulianDay());
var days = solar.subtract(firstDay);
if (days < m.getDayCount()) {
lunarYear = m.getYear();
lunarMonth = m.getMonth();
lunarDay = days + 1;
break;
}
}
return new Lunar(lunarYear, lunarMonth, lunarDay, solar.getHour(), solar.getMinute(), solar.getSecond(), solar, ly);
};
Lunar.fromDate = function (date) {
return Lunar.fromSolar(Solar.fromDate(date));
};
Lunar._computeJieQi = function (o, ly) {
var julianDays = ly.getJieQiJulianDays();
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length; i < j; i++) {
var key = Lunar.JIE_QI_IN_USE[i];
o.jieQiList.push(key);
o.jieQi.set(key, Solar.fromJulianDay(julianDays[i]));
}
};
Lunar._computeYear = function (o, solar, year) {
var offset = year - 4;
var yearGanIndex = offset % 10;
var yearZhiIndex = offset % 12;
if (yearGanIndex < 0) {
yearGanIndex += 10;
}
if (yearZhiIndex < 0) {
yearZhiIndex += 12;
}
var g = yearGanIndex;
var z = yearZhiIndex;
var gExact = yearGanIndex;
var zExact = yearZhiIndex;
var solarYear = solar.getYear();
var solarYmd = solar.toYmd();
var solarYmdHms = solar.toYmdHms();
var liChun = o.jieQi.get('立春');
if (liChun.getYear() != solarYear) {
liChun = o.jieQi.get('LI_CHUN');
}
var liChunYmd = liChun.toYmd();
var liChunYmdHms = liChun.toYmdHms();
if (year === solarYear) {
if (solarYmd < liChunYmd) {
g--;
z--;
}
if (solarYmdHms < liChunYmdHms) {
gExact--;
zExact--;
}
}
else if (year < solarYear) {
if (solarYmd >= liChunYmd) {
g++;
z++;
}
if (solarYmdHms >= liChunYmdHms) {
gExact++;
zExact++;
}
}
o.yearGanIndex = yearGanIndex;
o.yearZhiIndex = yearZhiIndex;
o.yearGanIndexByLiChun = (g < 0 ? g + 10 : g) % 10;
o.yearZhiIndexByLiChun = (z < 0 ? z + 12 : z) % 12;
o.yearGanIndexExact = (gExact < 0 ? gExact + 10 : gExact) % 10;
o.yearZhiIndexExact = (zExact < 0 ? zExact + 12 : zExact) % 12;
};
Lunar._computeMonth = function (o, solar) {
var start = null, i;
var end;
var ymd = solar.toYmd();
var time = solar.toYmdHms();
var size = Lunar.JIE_QI_IN_USE.length;
var index = -3;
for (i = 0; i < size; i += 2) {
end = o.jieQi.get(Lunar.JIE_QI_IN_USE[i]);
var symd = null == start ? ymd : start.toYmd();
if (ymd >= symd && ymd < end.toYmd()) {
break;
}
start = end;
index++;
}
var offset = (((o.yearGanIndexByLiChun + (index < 0 ? 1 : 0)) % 5 + 1) * 2) % 10;
o.monthGanIndex = ((index < 0 ? index + 10 : index) + offset) % 10;
o.monthZhiIndex = ((index < 0 ? index + 12 : index) + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12;
start = null;
index = -3;
for (i = 0; i < size; i += 2) {
end = o.jieQi.get(Lunar.JIE_QI_IN_USE[i]);
var stime = null == start ? time : start.toYmdHms();
if (time >= stime && time < end.toYmdHms()) {
break;
}
start = end;
index++;
}
offset = (((o.yearGanIndexExact + (index < 0 ? 1 : 0)) % 5 + 1) * 2) % 10;
o.monthGanIndexExact = ((index < 0 ? index + 10 : index) + offset) % 10;
o.monthZhiIndexExact = ((index < 0 ? index + 12 : index) + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12;
};
Lunar._computeDay = function (o, solar, hour, minute) {
var noon = Solar.fromYmdHms(solar.getYear(), solar.getMonth(), solar.getDay(), 12, 0, 0);
var offset = Math.floor(noon.getJulianDay()) - 11;
var dayGanIndex = offset % 10;
var dayZhiIndex = offset % 12;
o.dayGanIndex = dayGanIndex;
o.dayZhiIndex = dayZhiIndex;
var dayGanExact = dayGanIndex;
var dayZhiExact = dayZhiIndex;
o.dayGanIndexExact2 = dayGanExact;
o.dayZhiIndexExact2 = dayZhiExact;
var hm = (hour < 10 ? '0' : '') + hour + ':' + (minute < 10 ? '0' : '') + minute;
if (hm >= '23:00' && hm <= '23:59') {
dayGanExact++;
if (dayGanExact >= 10) {
dayGanExact -= 10;
}
dayZhiExact++;
if (dayZhiExact >= 12) {
dayZhiExact -= 12;
}
}
o.dayGanIndexExact = dayGanExact;
o.dayZhiIndexExact = dayZhiExact;
};
Lunar._computeTime = function (o, hour, minute) {
var timeZhiIndex = LunarUtil.getTimeZhiIndex((hour < 10 ? '0' : '') + hour + ':' + (minute < 10 ? '0' : '') + minute);
o.timeZhiIndex = timeZhiIndex;
o.timeGanIndex = (o.dayGanIndexExact % 5 * 2 + timeZhiIndex) % 10;
};
Lunar._computeWeek = function (o, solar) {
o.weekIndex = solar.getWeek();
};
Lunar._compute = function (year, hour, minute, solar, ly) {
var o = {
timeGanIndex: 0,
timeZhiIndex: 0,
dayGanIndex: 0,
dayZhiIndex: 0,
dayGanIndexExact: 0,
dayZhiIndexExact: 0,
dayGanIndexExact2: 0,
dayZhiIndexExact2: 0,
monthGanIndex: 0,
monthZhiIndex: 0,
monthGanIndexExact: 0,
monthZhiIndexExact: 0,
yearGanIndex: 0,
yearZhiIndex: 0,
yearGanIndexByLiChun: 0,
yearZhiIndexByLiChun: 0,
yearGanIndexExact: 0,
yearZhiIndexExact: 0,
weekIndex: 0,
jieQi: new Dictionary(),
jieQiList: []
};
Lunar._computeJieQi(o, ly);
Lunar._computeYear(o, solar, year);
Lunar._computeMonth(o, solar);
Lunar._computeDay(o, solar, hour, minute);
Lunar._computeTime(o, hour, minute);
Lunar._computeWeek(o, solar);
return o;
};
Lunar.prototype.getYear = function () {
return this._year;
};
Lunar.prototype.getMonth = function () {
return this._month;
};
Lunar.prototype.getDay = function () {
return this._day;
};
Lunar.prototype.getHour = function () {
return this._hour;
};
Lunar.prototype.getMinute = function () {
return this._minute;
};
Lunar.prototype.getSecond = function () {
return this._second;
};
Lunar.prototype.getTimeGanIndex = function () {
return this._timeGanIndex;
};
Lunar.prototype.getTimeZhiIndex = function () {
return this._timeZhiIndex;
};
Lunar.prototype.getDayGanIndex = function () {
return this._dayGanIndex;
};
Lunar.prototype.getDayZhiIndex = function () {
return this._dayZhiIndex;
};
Lunar.prototype.getMonthGanIndex = function () {
return this._monthGanIndex;
};
Lunar.prototype.getMonthZhiIndex = function () {
return this._monthZhiIndex;
};
Lunar.prototype.getYearGanIndex = function () {
return this._yearGanIndex;
};
Lunar.prototype.getYearZhiIndex = function () {
return this._yearZhiIndex;
};
Lunar.prototype.getYearGanIndexByLiChun = function () {
return this._yearGanIndexByLiChun;
};
Lunar.prototype.getYearZhiIndexByLiChun = function () {
return this._yearZhiIndexByLiChun;
};
Lunar.prototype.getDayGanIndexExact = function () {
return this._dayGanIndexExact;
};
Lunar.prototype.getDayZhiIndexExact = function () {
return this._dayZhiIndexExact;
};
Lunar.prototype.getDayGanIndexExact2 = function () {
return this._dayGanIndexExact2;
};
Lunar.prototype.getDayZhiIndexExact2 = function () {
return this._dayZhiIndexExact2;
};
Lunar.prototype.getMonthGanIndexExact = function () {
return this._monthGanIndexExact;
};
Lunar.prototype.getMonthZhiIndexExact = function () {
return this._monthZhiIndexExact;
};
Lunar.prototype.getYearGanIndexExact = function () {
return this._yearGanIndexExact;
};
Lunar.prototype.getYearZhiIndexExact = function () {
return this._yearZhiIndexExact;
};
Lunar.prototype.getGan = function () {
return this.getYearGan();
};
Lunar.prototype.getZhi = function () {
return this.getYearZhi();
};
Lunar.prototype.getYearGan = function () {
return LunarUtil.GAN[this._yearGanIndex + 1];
};
Lunar.prototype.getYearGanByLiChun = function () {
return LunarUtil.GAN[this._yearGanIndexByLiChun + 1];
};
Lunar.prototype.getYearGanExact = function () {
return LunarUtil.GAN[this._yearGanIndexExact + 1];
};
Lunar.prototype.getYearZhi = function () {
return LunarUtil.ZHI[this._yearZhiIndex + 1];
};
Lunar.prototype.getYearZhiByLiChun = function () {
return LunarUtil.ZHI[this._yearZhiIndexByLiChun + 1];
};
Lunar.prototype.getYearZhiExact = function () {
return LunarUtil.ZHI[this._yearZhiIndexExact + 1];
};
Lunar.prototype.getYearInGanZhi = function () {
return this.getYearGan() + this.getYearZhi();
};
Lunar.prototype.getYearInGanZhiByLiChun = function () {
return this.getYearGanByLiChun() + this.getYearZhiByLiChun();
};
Lunar.prototype.getYearInGanZhiExact = function () {
return this.getYearGanExact() + this.getYearZhiExact();
};
Lunar.prototype.getMonthGan = function () {
return LunarUtil.GAN[this._monthGanIndex + 1];
};
Lunar.prototype.getMonthGanExact = function () {
return LunarUtil.GAN[this._monthGanIndexExact + 1];
};
Lunar.prototype.getMonthZhi = function () {
return LunarUtil.ZHI[this._monthZhiIndex + 1];
};
Lunar.prototype.getMonthZhiExact = function () {
return LunarUtil.ZHI[this._monthZhiIndexExact + 1];
};
Lunar.prototype.getMonthInGanZhi = function () {
return this.getMonthGan() + this.getMonthZhi();
};
Lunar.prototype.getMonthInGanZhiExact = function () {
return this.getMonthGanExact() + this.getMonthZhiExact();
};
Lunar.prototype.getDayGan = function () {
return LunarUtil.GAN[this._dayGanIndex + 1];
};
Lunar.prototype.getDayGanExact = function () {
return LunarUtil.GAN[this._dayGanIndexExact + 1];
};
Lunar.prototype.getDayGanExact2 = function () {
return LunarUtil.GAN[this._dayGanIndexExact2 + 1];
};
Lunar.prototype.getDayZhi = function () {
return LunarUtil.ZHI[this._dayZhiIndex + 1];
};
Lunar.prototype.getDayZhiExact = function () {
return LunarUtil.ZHI[this._dayZhiIndexExact + 1];
};
Lunar.prototype.getDayZhiExact2 = function () {
return LunarUtil.ZHI[this._dayZhiIndexExact2 + 1];
};
Lunar.prototype.getDayInGanZhi = function () {
return this.getDayGan() + this.getDayZhi();
};
Lunar.prototype.getDayInGanZhiExact = function () {
return this.getDayGanExact() + this.getDayZhiExact();
};
Lunar.prototype.getDayInGanZhiExact2 = function () {
return this.getDayGanExact2() + this.getDayZhiExact2();
};
Lunar.prototype.getTimeGan = function () {
return LunarUtil.GAN[this._timeGanIndex + 1];
};
Lunar.prototype.getTimeZhi = function () {
return LunarUtil.ZHI[this._timeZhiIndex + 1];
};
Lunar.prototype.getTimeInGanZhi = function () {
return this.getTimeGan() + this.getTimeZhi();
};
Lunar.prototype.getShengxiao = function () {
return this.getYearShengXiao();
};
Lunar.prototype.getYearShengXiao = function () {
return LunarUtil.SHENGXIAO[this._yearZhiIndex + 1];
};
Lunar.prototype.getYearShengXiaoByLiChun = function () {
return LunarUtil.SHENGXIAO[this._yearZhiIndexByLiChun + 1];
};
Lunar.prototype.getYearShengXiaoExact = function () {
return LunarUtil.SHENGXIAO[this._yearZhiIndexExact + 1];
};
Lunar.prototype.getMonthShengXiao = function () {
return LunarUtil.SHENGXIAO[this._monthZhiIndex + 1];
};
Lunar.prototype.getMonthShengXiaoExact = function () {
return LunarUtil.SHENGXIAO[this._monthZhiIndexExact + 1];
};
Lunar.prototype.getDayShengXiao = function () {
return LunarUtil.SHENGXIAO[this._dayZhiIndex + 1];
};
Lunar.prototype.getTimeShengXiao = function () {
return LunarUtil.SHENGXIAO[this._timeZhiIndex + 1];
};
Lunar.prototype.getYearInChinese = function () {
var y = this._year + '';
var s = '';
var zero = '0'.charCodeAt(0);
for (var i = 0, j = y.length; i < j; i++) {
var n = y.charCodeAt(i);
s += LunarUtil.NUMBER[n - zero];
}
return s;
};
Lunar.prototype.getMonthInChinese = function () {
return (this._month < 0 ? '闰' : '') + LunarUtil.MONTH[Math.abs(this._month)];
};
Lunar.prototype.getDayInChinese = function () {
return LunarUtil.DAY[this._day];
};
Lunar.prototype.getPengZuGan = function () {
return LunarUtil.PENGZU_GAN[this._dayGanIndex + 1];
};
Lunar.prototype.getPengZuZhi = function () {
return LunarUtil.PENGZU_ZHI[this._dayZhiIndex + 1];
};
Lunar.prototype.getPositionXi = function () {
return this.getDayPositionXi();
};
Lunar.prototype.getPositionXiDesc = function () {
return this.getDayPositionXiDesc();
};
Lunar.prototype.getPositionYangGui = function () {
return this.getDayPositionYangGui();
};
Lunar.prototype.getPositionYangGuiDesc = function () {
return this.getDayPositionYangGuiDesc();
};
Lunar.prototype.getPositionYinGui = function () {
return this.getDayPositionYinGui();
};
Lunar.prototype.getPositionYinGuiDesc = function () {
return this.getDayPositionYinGuiDesc();
};
Lunar.prototype.getPositionFu = function () {
return this.getDayPositionFu();
};
Lunar.prototype.getPositionFuDesc = function () {
return this.getDayPositionFuDesc();
};
Lunar.prototype.getPositionCai = function () {
return this.getDayPositionCai();
};
Lunar.prototype.getPositionCaiDesc = function () {
return this.getDayPositionCaiDesc();
};
Lunar.prototype.getDayPositionXi = function () {
return LunarUtil.POSITION_XI[this._dayGanIndex + 1];
};
Lunar.prototype.getDayPositionXiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getDayPositionXi());
return v ? v : '';
};
Lunar.prototype.getDayPositionYangGui = function () {
return LunarUtil.POSITION_YANG_GUI[this._dayGanIndex + 1];
};
Lunar.prototype.getDayPositionYangGuiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getDayPositionYangGui());
return v ? v : '';
};
Lunar.prototype.getDayPositionYinGui = function () {
return LunarUtil.POSITION_YIN_GUI[this._dayGanIndex + 1];
};
Lunar.prototype.getDayPositionYinGuiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getDayPositionYinGui());
return v ? v : '';
};
Lunar.prototype.getDayPositionFu = function (sect) {
if (sect === void 0) { sect = 2; }
return (1 === sect ? LunarUtil.POSITION_FU : LunarUtil.POSITION_FU_2)[this._dayGanIndex + 1];
};
Lunar.prototype.getDayPositionFuDesc = function (sect) {
if (sect === void 0) { sect = 2; }
var v = LunarUtil.POSITION_DESC.get(this.getDayPositionFu(sect));
return v ? v : '';
};
Lunar.prototype.getDayPositionCai = function () {
return LunarUtil.POSITION_CAI[this._dayGanIndex + 1];
};
Lunar.prototype.getDayPositionCaiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getDayPositionCai());
return v ? v : '';
};
Lunar.prototype.getTimePositionXi = function () {
return LunarUtil.POSITION_XI[this._timeGanIndex + 1];
};
Lunar.prototype.getTimePositionXiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getTimePositionXi());
return v ? v : '';
};
Lunar.prototype.getTimePositionYangGui = function () {
return LunarUtil.POSITION_YANG_GUI[this._timeGanIndex + 1];
};
Lunar.prototype.getTimePositionYangGuiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getTimePositionYangGui());
return v ? v : '';
};
Lunar.prototype.getTimePositionYinGui = function () {
return LunarUtil.POSITION_YIN_GUI[this._timeGanIndex + 1];
};
Lunar.prototype.getTimePositionYinGuiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getTimePositionYinGui());
return v ? v : '';
};
Lunar.prototype.getTimePositionFu = function (sect) {
if (sect === void 0) { sect = 2; }
return (1 === sect ? LunarUtil.POSITION_FU : LunarUtil.POSITION_FU_2)[this._timeGanIndex + 1];
};
Lunar.prototype.getTimePositionFuDesc = function (sect) {
if (sect === void 0) { sect = 2; }
var v = LunarUtil.POSITION_DESC.get(this.getTimePositionFu(sect));
return v ? v : '';
};
Lunar.prototype.getTimePositionCai = function () {
return LunarUtil.POSITION_CAI[this._timeGanIndex + 1];
};
Lunar.prototype.getTimePositionCaiDesc = function () {
var v = LunarUtil.POSITION_DESC.get(this.getTimePositionCai());
return v ? v : '';
};
Lunar.prototype.getYearPositionTaiSui = function (sect) {
if (sect === void 0) { sect = 2; }
var yearZhiIndex;
switch (sect) {
case 1:
yearZhiIndex = this._yearZhiIndex;
break;
case 3:
yearZhiIndex = this._yearZhiIndexExact;
break;
default:
yearZhiIndex = this._yearZhiIndexByLiChun;
}
return LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
};
Lunar.prototype.getYearPositionTaiSuiDesc = function (sect) {
if (sect === void 0) { sect = 2; }
return LunarUtil.POSITION_DESC.get(this.getYearPositionTaiSui(sect));
};
Lunar.prototype._getMonthPositionTaiSui = function (monthZhiIndex, monthGanIndex) {
var p;
var m = monthZhiIndex - LunarUtil.BASE_MONTH_ZHI_INDEX;
if (m < 0) {
m += 12;
}
switch (m) {
case 0:
case 4:
case 8:
p = '艮';
break;
case 2:
case 6:
case 10:
p = '坤';
break;
case 3:
case 7:
case 11:
p = '巽';
break;
default:
p = LunarUtil.POSITION_GAN[monthGanIndex];
}
return p;
};
Lunar.prototype.getMonthPositionTaiSui = function (sect) {
if (sect === void 0) { sect = 2; }
var monthZhiIndex;
var monthGanIndex;
switch (sect) {
case 3:
monthZhiIndex = this._monthZhiIndexExact;
monthGanIndex = this._monthGanIndexExact;
break;
default:
monthZhiIndex = this._monthZhiIndex;
monthGanIndex = this._monthGanIndex;
}
return this._getMonthPositionTaiSui(monthZhiIndex, monthGanIndex);
};
Lunar.prototype.getMonthPositionTaiSuiDesc = function (sect) {
if (sect === void 0) { sect = 2; }
return LunarUtil.POSITION_DESC.get(this.getMonthPositionTaiSui(sect));
};
Lunar.prototype._getDayPositionTaiSui = function (dayInGanZhi, yearZhiIndex) {
var p;
if ('甲子,乙丑,丙寅,丁卯,戊辰,已巳'.indexOf(dayInGanZhi) > -1) {
p = '震';
}
else if ('丙子,丁丑,戊寅,已卯,庚辰,辛巳'.indexOf(dayInGanZhi) > -1) {
p = '离';
}
else if ('戊子,已丑,庚寅,辛卯,壬辰,癸巳'.indexOf(dayInGanZhi) > -1) {
p = '中';
}
else if ('庚子,辛丑,壬寅,癸卯,甲辰,乙巳'.indexOf(dayInGanZhi) > -1) {
p = '兑';
}
else if ('壬子,癸丑,甲寅,乙卯,丙辰,丁巳'.indexOf(dayInGanZhi) > -1) {
p = '坎';
}
else {
p = LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
}
return p;
};
Lunar.prototype.getDayPositionTaiSui = function (sect) {
if (sect === void 0) { sect = 2; }
var dayInGanZhi;
var yearZhiIndex;
switch (sect) {
case 1:
dayInGanZhi = this.getDayInGanZhi();
yearZhiIndex = this._yearZhiIndex;
break;
case 3:
dayInGanZhi = this.getDayInGanZhi();
yearZhiIndex = this._yearZhiIndexExact;
break;
default:
dayInGanZhi = this.getDayInGanZhiExact2();
yearZhiIndex = this._yearZhiIndexByLiChun;
}
return this._getDayPositionTaiSui(dayInGanZhi, yearZhiIndex);
};
Lunar.prototype.getDayPositionTaiSuiDesc = function (sect) {
if (sect === void 0) { sect = 2; }
return LunarUtil.POSITION_DESC.get(this.getDayPositionTaiSui(sect));
};
Lunar.prototype.getChong = function () {
return this.getDayChong();
};
Lunar.prototype.getChongGan = function () {
return this.getDayChongGan();
};
Lunar.prototype.getChongGanTie = function () {
return this.getDayChongGanTie();
};
Lunar.prototype.getChongShengXiao = function () {
return this.getDayChongShengXiao();
};
Lunar.prototype.getChongDesc = function () {
return this.getDayChongDesc();
};
Lunar.prototype.getSha = function () {
return this.getDaySha();
};
Lunar.prototype.getDayChong = function () {
return LunarUtil.CHONG[this._dayZhiIndex];
};
Lunar.prototype.getDayChongGan = function () {
return LunarUtil.CHONG_GAN[this._dayGanIndex];
};
Lunar.prototype.getDayChongGanTie = function () {
return LunarUtil.CHONG_GAN_TIE[this._dayGanIndex];
};
Lunar.prototype.getDayChongShengXiao = function () {
var chong = this.getChong();
for (var i = 0, j = LunarUtil.ZHI.length; i < j; i++) {
if (LunarUtil.ZHI[i] === chong) {
return LunarUtil.SHENGXIAO[i];
}
}
return '';
};
Lunar.prototype.getDayChongDesc = function () {
return '(' + this.getDayChongGan() + this.getDayChong() + ')' + this.getDayChongShengXiao();
};
Lunar.prototype.getDaySha = function () {
var v = LunarUtil.SHA.get(this.getDayZhi());
return v ? v : '';
};
Lunar.prototype.getTimeChong = function () {
return LunarUtil.CHONG[this._timeZhiIndex];
};
Lunar.prototype.getTimeChongGan = function () {
return LunarUtil.CHONG_GAN[this._timeGanIndex];
};
Lunar.prototype.getTimeChongGanTie = function () {
return LunarUtil.CHONG_GAN_TIE[this._timeGanIndex];
};
Lunar.prototype.getTimeChongShengXiao = function () {
var chong = this.getTimeChong();
for (var i = 0, j = LunarUtil.ZHI.length; i < j; i++) {
if (LunarUtil.ZHI[i] === chong) {
return LunarUtil.SHENGXIAO[i];
}
}
return '';
};
Lunar.prototype.getTimeChongDesc = function () {
return '(' + this.getTimeChongGan() + this.getTimeChong() + ')' + this.getTimeChongShengXiao();
};
Lunar.prototype.getTimeSha = function () {
var v = LunarUtil.SHA.get(this.getTimeZhi());
return v ? v : '';
};
Lunar.prototype.getYearNaYin = function () {
var v = LunarUtil.NAYIN.get(this.getYearInGanZhi());
return v ? v : '';
};
Lunar.prototype.getMonthNaYin = function () {
var v = LunarUtil.NAYIN.get(this.getMonthInGanZhi());
return v ? v : '';
};
Lunar.prototype.getDayNaYin = function () {
var v = LunarUtil.NAYIN.get(this.getDayInGanZhi());
return v ? v : '';
};
Lunar.prototype.getTimeNaYin = function () {
var v = LunarUtil.NAYIN.get(this.getTimeInGanZhi());
return v ? v : '';
};
Lunar.prototype.getSeason = function () {
return LunarUtil.SEASON[Math.abs(this._month)];
};
Lunar._convertJieQi = function (name) {
var jq = name;
if ('DONG_ZHI' === jq) {
jq = '冬至';
}
else if ('DA_HAN' === jq) {
jq = '大寒';
}
else if ('XIAO_HAN' === jq) {
jq = '小寒';
}
else if ('LI_CHUN' === jq) {
jq = '立春';
}
else if ('DA_XUE' === jq) {
jq = '大雪';
}
else if ('YU_SHUI' === jq) {
jq = '雨水';
}
else if ('JING_ZHE' === jq) {
jq = '惊蛰';
}
return jq;
};
Lunar.prototype.getJie = function () {
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length; i < j; i += 2) {
var key = Lunar.JIE_QI_IN_USE[i];
var d = this._jieQi.get(key);
if (d && d.getYear() === this._solar.getYear() && d.getMonth() === this._solar.getMonth() && d.getDay() === this._solar.getDay()) {
return Lunar._convertJieQi(key);
}
}
return '';
};
Lunar.prototype.getQi = function () {
for (var i = 1, j = Lunar.JIE_QI_IN_USE.length; i < j; i += 2) {
var key = Lunar.JIE_QI_IN_USE[i];
var d = this._jieQi.get(key);
if (d && d.getYear() === this._solar.getYear() && d.getMonth() === this._solar.getMonth() && d.getDay() === this._solar.getDay()) {
return Lunar._convertJieQi(key);
}
}
return '';
};
Lunar.prototype.getJieQi = function () {
var _this = this;
var name = '';
this._jieQi.forEach(function (k, d) {
if (d.getYear() == _this._solar.getYear() && d.getMonth() == _this._solar.getMonth() && d.getDay() == _this._solar.getDay()) {
name = k;
return false;
}
});
return Lunar._convertJieQi(name);
};
Lunar.prototype.getWeek = function () {
return this._weekIndex;
};
Lunar.prototype.getWeekInChinese = function () {
return SolarUtil.WEEK[this.getWeek()];
};
Lunar.prototype.getXiu = function () {
var v = LunarUtil.XIU.get(this.getDayZhi() + this.getWeek());
return v ? v : '';
};
Lunar.prototype.getXiuLuck = function () {
var v = LunarUtil.XIU_LUCK.get(this.getXiu());
return v ? v : '';
};
Lunar.prototype.getXiuSong = function () {
var v = LunarUtil.XIU_SONG.get(this.getXiu());
return v ? v : '';
};
Lunar.prototype.getZheng = function () {
var v = LunarUtil.ZHENG.get(this.getXiu());
return v ? v : '';
};
Lunar.prototype.getAnimal = function () {
var v = LunarUtil.ANIMAL.get(this.getXiu());
return v ? v : '';
};
Lunar.prototype.getGong = function () {
var v = LunarUtil.GONG.get(this.getXiu());
return v ? v : '';
};
Lunar.prototype.getShou = function () {
var v = LunarUtil.SHOU.get(this.getGong());
return v ? v : '';
};
Lunar.prototype.getFestivals = function () {
var l = [];
var f = LunarUtil.FESTIVAL.get(this._month + '-' + this._day);
if (f) {
l.push(f);
}
if (Math.abs(this._month) == 12 && this._day >= 29 && this._year != this.next(1).getYear()) {
l.push('除夕');
}
return l;
};
Lunar.prototype.getOtherFestivals = function () {
var l = [];
var fs = LunarUtil.OTHER_FESTIVAL.get(this._month + '-' + this._day);
if (fs) {
fs.forEach(function (f) {
l.push(f);
});
}
var jq = this._jieQi.get('清明');
var solarYmd = this._solar.toYmd();
if (solarYmd === jq.next(-1).toYmd()) {
l.push('寒食节');
}
jq = this._jieQi.get('立春');
var offset = 4 - jq.getLunar().getDayGanIndex();
if (offset < 0) {
offset += 10;
}
if (solarYmd === jq.next(offset + 40).toYmd()) {
l.push('春社');
}
jq = this._jieQi.get('立秋');
offset = 4 - jq.getLunar().getDayGanIndex();
if (offset < 0) {
offset += 10;
}
if (solarYmd === jq.next(offset + 40).toYmd()) {
l.push('秋社');
}
return l;
};
Lunar.prototype.getBaZi = function () {
var bz = this.getEightChar();
var l = [];
l.push(bz.getYear());
l.push(bz.getMonth());
l.push(bz.getDay());
l.push(bz.getTime());
return l;
};
Lunar.prototype.getBaZiWuXing = function () {
var bz = this.getEightChar();
var l = [];
l.push(bz.getYearWuXing());
l.push(bz.getMonthWuXing());
l.push(bz.getDayWuXing());
l.push(bz.getTimeWuXing());
return l;
};
Lunar.prototype.getBaZiNaYin = function () {
var bz = this.getEightChar();
var l = [];
l.push(bz.getYearNaYin());
l.push(bz.getMonthNaYin());
l.push(bz.getDayNaYin());
l.push(bz.getTimeNaYin());
return l;
};
Lunar.prototype.getBaZiShiShenGan = function () {
var bz = this.getEightChar();
var l = [];
l.push(bz.getYearShiShenGan());
l.push(bz.getMonthShiShenGan());
l.push(bz.getDayShiShenGan());
l.push(bz.getTimeShiShenGan());
return l;
};
Lunar.prototype.getBaZiShiShenZhi = function () {
var bz = this.getEightChar();
var l = [];
l.push(bz.getYearShiShenZhi()[0]);
l.push(bz.getMonthShiShenZhi()[0]);
l.push(bz.getDayShiShenZhi()[0]);
l.push(bz.getTimeShiShenZhi()[0]);
return l;
};
Lunar.prototype.getBaZiShiShenYearZhi = function () {
return this.getEightChar().getYearShiShenZhi();
};
Lunar.prototype.getBaZiShiShenMonthZhi = function () {
return this.getEightChar().getMonthShiShenZhi();
};
Lunar.prototype.getBaZiShiShenDayZhi = function () {
return this.getEightChar().getDayShiShenZhi();
};
Lunar.prototype.getBaZiShiShenTimeZhi = function () {
return this.getEightChar().getTimeShiShenZhi();
};
Lunar.prototype.getZhiXing = function () {
var offset = this._dayZhiIndex - this._monthZhiIndex;
if (offset < 0) {
offset += 12;
}
return LunarUtil.ZHI_XING[offset + 1];
};
Lunar.prototype.getDayTianShen = function () {
var monthZhi = this.getMonthZhi();
var offset = LunarUtil.ZHI_TIAN_SHEN_OFFSET.get(monthZhi);
if (offset == undefined) {
return '';
}
return LunarUtil.TIAN_SHEN[(this._dayZhiIndex + offset) % 12 + 1];
};
Lunar.prototype.getTimeTianShen = function () {
var dayZhi = this.getDayZhiExact();
var offset = LunarUtil.ZHI_TIAN_SHEN_OFFSET.get(dayZhi);
if (offset == undefined) {
return '';
}
return LunarUtil.TIAN_SHEN[(this._timeZhiIndex + offset) % 12 + 1];
};
Lunar.prototype.getDayTianShenType = function () {
var v = LunarUtil.TIAN_SHEN_TYPE.get(this.getDayTianShen());
return v ? v : '';
};
Lunar.prototype.getTimeTianShenType = function () {
var v = LunarUtil.TIAN_SHEN_TYPE.get(this.getTimeTianShen());
return v ? v : '';
};
Lunar.prototype.getDayTianShenLuck = function () {
var v = LunarUtil.TIAN_SHEN_TYPE_LUCK.get(this.getDayTianShenType());
return v ? v : '';
};
Lunar.prototype.getTimeTianShenLuck = function () {
var v = LunarUtil.TIAN_SHEN_TYPE_LUCK.get(this.getTimeTianShenType());
return v ? v : '';
};
Lunar.prototype.getDayPositionTai = function () {
return LunarUtil.POSITION_TAI_DAY[LunarUtil.getJiaZiIndex(this.getDayInGanZhi())];
};
Lunar.prototype.getMonthPositionTai = function () {
var m = this._month;
if (m < 0) {
return '';
}
return LunarUtil.POSITION_TAI_MONTH[m - 1];
};
Lunar.prototype.getDayYi = function (sect) {
if (sect === void 0) { sect = 1; }
return LunarUtil.getDayYi(2 == sect ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(), this.getDayInGanZhi());
};
Lunar.prototype.getDayJi = function (sect) {
if (sect === void 0) { sect = 1; }
return LunarUtil.getDayJi(2 == sect ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(), this.getDayInGanZhi());
};
Lunar.prototype.getDayJiShen = function () {
return LunarUtil.getDayJiShen(this.getMonth(), this.getDayInGanZhi());
};
Lunar.prototype.getDayXiongSha = function () {
return LunarUtil.getDayXiongSha(this.getMonth(), this.getDayInGanZhi());
};
Lunar.prototype.getTimeYi = function () {
return LunarUtil.getTimeYi(this.getDayInGanZhiExact(), this.getTimeInGanZhi());
};
Lunar.prototype.getTimeJi = function () {
return LunarUtil.getTimeJi(this.getDayInGanZhiExact(), this.getTimeInGanZhi());
};
Lunar.prototype.getYueXiang = function () {
return LunarUtil.YUE_XIANG[this._day];
};
Lunar.prototype._getYearNineStar = function (yearInGanZhi) {
var indexExact = LunarUtil.getJiaZiIndex(yearInGanZhi) + 1;
var index = LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1;
var yearOffset = indexExact - index;
if (yearOffset > 1) {
yearOffset -= 60;
}
else if (yearOffset < -1) {
yearOffset += 60;
}
var yuan = Math.floor((this._year + yearOffset + 2696) / 60) % 3;
var offset = (62 + yuan * 3 - indexExact) % 9;
if (0 === offset) {
offset = 9;
}
return NineStar.fromIndex(offset - 1);
};
Lunar.prototype.getYearNineStar = function (sect) {
if (sect === void 0) { sect = 2; }
var yearInGanZhi;
switch (sect) {
case 1:
yearInGanZhi = this.getYearInGanZhi();
break;
case 3:
yearInGanZhi = this.getYearInGanZhiExact();
break;
default:
yearInGanZhi = this.getYearInGanZhiByLiChun();
}
return this._getYearNineStar(yearInGanZhi);
};
Lunar.prototype._getMonthNineStar = function (yearZhiIndex, monthZhiIndex) {
var index = yearZhiIndex % 3;
var n = 27 - (index * 3);
if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
n -= 3;
}
var offset = (n - monthZhiIndex) % 9;
return NineStar.fromIndex(offset);
};
Lunar.prototype.getMonthNineStar = function (sect) {
if (sect === void 0) { sect = 2; }
var yearZhiIndex;
var monthZhiIndex;
switch (sect) {
case 1:
yearZhiIndex = this._yearZhiIndex;
monthZhiIndex = this._monthZhiIndex;
break;
case 3:
yearZhiIndex = this._yearZhiIndexExact;
monthZhiIndex = this._monthZhiIndexExact;
break;
default:
yearZhiIndex = this._yearZhiIndexByLiChun;
monthZhiIndex = this._monthZhiIndex;
}
return this._getMonthNineStar(yearZhiIndex, monthZhiIndex);
};
Lunar.prototype.getJieQiSolar = function (name) {
return this._jieQi.get(name);
};
Lunar.prototype.getDayNineStar = function () {
var solarYmd = this._solar.toYmd();
var dongZhi = this.getJieQiSolar('冬至');
var dongZhi2 = this.getJieQiSolar('DONG_ZHI');
var xiaZhi = this.getJieQiSolar('夏至');
var dongZhiIndex = LunarUtil.getJiaZiIndex(dongZhi.getLunar().getDayInGanZhi());
var dongZhiIndex2 = LunarUtil.getJiaZiIndex(dongZhi2.getLunar().getDayInGanZhi());
var xiaZhiIndex = LunarUtil.getJiaZiIndex(xiaZhi.getLunar().getDayInGanZhi());
var solarShunBai;
var solarShunBai2;
var solarNiZi;
if (dongZhiIndex > 29) {
solarShunBai = dongZhi.next(60 - dongZhiIndex);
}
else {
solarShunBai = dongZhi.next(-dongZhiIndex);
}
var solarShunBaiYmd = solarShunBai.toYmd();
if (dongZhiIndex2 > 29) {
solarShunBai2 = dongZhi2.next(60 - dongZhiIndex2);
}
else {
solarShunBai2 = dongZhi2.next(-dongZhiIndex2);
}
var solarShunBaiYmd2 = solarShunBai2.toYmd();
if (xiaZhiIndex > 29) {
solarNiZi = xiaZhi.next(60 - xiaZhiIndex);
}
else {
solarNiZi = xiaZhi.next(-xiaZhiIndex);
}
var solarNiZiYmd = solarNiZi.toYmd();
var offset = 0;
if (solarYmd >= solarShunBaiYmd && solarYmd < solarNiZiYmd) {
offset = this._solar.subtract(solarShunBai) % 9;
}
else if (solarYmd >= solarNiZiYmd && solarYmd < solarShunBaiYmd2) {
offset = 8 - (this._solar.subtract(solarNiZi) % 9);
}
else if (solarYmd >= solarShunBaiYmd2) {
offset = this._solar.subtract(solarShunBai2) % 9;
}
else if (solarYmd < solarShunBaiYmd) {
offset = (8 + solarShunBai.subtract(this._solar)) % 9;
}
return NineStar.fromIndex(offset);
};
Lunar.prototype.getTimeNineStar = function () {
var solarYmd = this._solar.toYmd();
var asc = false;
if (solarYmd >= this.getJieQiSolar('冬至').toYmd() && solarYmd < this.getJieQiSolar('夏至').toYmd()) {
asc = true;
}
else if (solarYmd >= this.getJieQiSolar('DONG_ZHI').toYmd()) {
asc = true;
}
var start = asc ? 6 : 2;
var dayZhi = this.getDayZhi();
if ('子午卯酉'.indexOf(dayZhi) > -1) {
start = asc ? 0 : 8;
}
else if ('辰戌丑未'.indexOf(dayZhi) > -1) {
start = asc ? 3 : 5;
}
var index = asc ? (start + this._timeZhiIndex) : (start + 9 - this._timeZhiIndex);
return NineStar.fromIndex(index % 9);
};
Lunar.prototype.getSolar = function () {
return this._solar;
};
Lunar.prototype.getJieQiTable = function () {
return this._jieQi;
};
Lunar.prototype.getJieQiList = function () {
return this._jieQiList;
};
Lunar.prototype.getNextJie = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
var conditions = [];
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length / 2; i < j; i++) {
conditions.push(Lunar.JIE_QI_IN_USE[i * 2]);
}
return this.getNearJieQi(true, conditions, wholeDay);
};
Lunar.prototype.getPrevJie = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
var conditions = [];
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length / 2; i < j; i++) {
conditions.push(Lunar.JIE_QI_IN_USE[i * 2]);
}
return this.getNearJieQi(false, conditions, wholeDay);
};
Lunar.prototype.getNextQi = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
var conditions = [];
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length / 2; i < j; i++) {
conditions.push(Lunar.JIE_QI_IN_USE[i * 2 + 1]);
}
return this.getNearJieQi(true, conditions, wholeDay);
};
Lunar.prototype.getPrevQi = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
var conditions = [];
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length / 2; i < j; i++) {
conditions.push(Lunar.JIE_QI_IN_USE[i * 2 + 1]);
}
return this.getNearJieQi(false, conditions, wholeDay);
};
Lunar.prototype.getNextJieQi = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
return this.getNearJieQi(true, [], wholeDay);
};
Lunar.prototype.getPrevJieQi = function (wholeDay) {
if (wholeDay === void 0) { wholeDay = false; }
return this.getNearJieQi(false, [], wholeDay);
};
Lunar.prototype.getNearJieQi = function (forward, conditions, wholeDay) {
var name = '';
var near = null;
var filters = new Dictionary();
var filter = false;
if (conditions) {
for (var i = 0, j = conditions.length; i < j; i++) {
filters.set(conditions[i], true);
filter = true;
}
}
var today = wholeDay ? this._solar.toYmd() : this._solar.toYmdHms();
this._jieQi.forEach(function (key, solar) {
var jq = Lunar._convertJieQi(key);
if (filter) {
if (!filters.containsKey(jq)) {
return;
}
}
var day = wholeDay ? solar.toYmd() : solar.toYmdHms();
if (forward) {
if (day < today) {
return;
}
if (null == near) {
name = jq;
near = solar;
}
else {
var nearDay = wholeDay ? near.toYmd() : near.toYmdHms();
if (day < nearDay) {
name = jq;
near = solar;
}
}
}
else {
if (day > today) {
return;
}
if (null == near) {
name = jq;
near = solar;
}
else {
var nearDay = wholeDay ? near.toYmd() : near.toYmdHms();
if (day > nearDay) {
name = jq;
near = solar;
}
}
}
});
return new JieQi(name, near);
};
Lunar.prototype.getCurrentJieQi = function () {
var _this = this;
var jq = null;
this._jieQi.forEach(function (k, d) {
if (d.getYear() == _this._solar.getYear() && d.getMonth() == _this._solar.getMonth() && d.getDay() == _this._solar.getDay()) {
jq = new JieQi(Lunar._convertJieQi(k), d);
return false;
}
});
return jq;
};
Lunar.prototype.getCurrentJie = function () {
for (var i = 0, j = Lunar.JIE_QI_IN_USE.length; i < j; i += 2) {
var key = Lunar.JIE_QI_IN_USE[i];
var d = this._jieQi.get(key);
if (d && d.getYear() === this._solar.getYear() && d.getMonth() === this._solar.getMonth() && d.getDay() === this._solar.getDay()) {
return new JieQi(Lunar._convertJieQi(key), d);
}
}
return null;
};
Lunar.prototype.getCurrentQi = function () {
for (var i = 1, j = Lunar.JIE_QI_IN_USE.length; i < j; i += 2) {
var key = Lunar.JIE_QI_IN_USE[i];
var d = this._jieQi.get(key);
if (d && d.getYear() === this._solar.getYear() && d.getMonth() === this._solar.getMonth() && d.getDay() === this._solar.getDay()) {
return new JieQi(Lunar._convertJieQi(key), d);
}
}
return null;
};
Lunar.prototype.getEightChar = function () {
return this._eightChar;
};
Lunar.prototype.next = function (days) {
return this._solar.next(days).getLunar();
};
Lunar.prototype.getYearXun = function () {
return LunarUtil.getXun(this.getYearInGanZhi());
};
Lunar.prototype.getMonthXun = function () {
return LunarUtil.getXun(this.getMonthInGanZhi());
};
Lunar.prototype.getDayXun = function () {
return LunarUtil.getXun(this.getDayInGanZhi());
};
Lunar.prototype.getTimeXun = function () {
return LunarUtil.getXun(this.getTimeInGanZhi());
};
Lunar.prototype.getYearXunByLiChun = function () {
return LunarUtil.getXun(this.getYearInGanZhiByLiChun());
};
Lunar.prototype.getYearXunExact = function () {
return LunarUtil.getXun(this.getYearInGanZhiExact());
};
Lunar.prototype.getMonthXunExact = function () {
return LunarUtil.getXun(this.getMonthInGanZhiExact());
};
Lunar.prototype.getDayXunExact = function () {
return LunarUtil.getXun(this.getDayInGanZhiExact());
};
Lunar.prototype.getDayXunExact2 = function () {
return LunarUtil.getXun(this.getDayInGanZhiExact2());
};
Lunar.prototype.getYearXunKong = function () {
return LunarUtil.getXunKong(this.getYearInGanZhi());
};
Lunar.prototype.getMonthXunKong = function () {
return LunarUtil.getXunKong(this.getMonthInGanZhi());
};
Lunar.prototype.getDayXunKong = function () {
return LunarUtil.getXunKong(this.getDayInGanZhi());
};
Lunar.prototype.getTimeXunKong = function () {
return LunarUtil.getXunKong(this.getTimeInGanZhi());
};
Lunar.prototype.getYearXunKongByLiChun = function () {
return LunarUtil.getXunKong(this.getYearInGanZhiByLiChun());
};
Lunar.prototype.getYearXunKongExact = function () {
return LunarUtil.getXunKong(this.getYearInGanZhiExact());
};
Lunar.prototype.getMonthXunKongExact = function () {
return LunarUtil.getXunKong(this.getMonthInGanZhiExact());
};
Lunar.prototype.getDayXunKongExact = function () {
return LunarUtil.getXunKong(this.getDayInGanZhiExact());
};
Lunar.prototype.getDayXunKongExact2 = function () {
return LunarUtil.getXunKong(this.getDayInGanZhiExact2());
};
Lunar.prototype.toString = function () {