|
|
|
|
;(function(root,factory){
|
|
|
|
|
if (typeof define==='function'&&define.amd){
|
|
|
|
|
define(factory);
|
|
|
|
|
}else if(typeof module!='undefined'&&module.exports){
|
|
|
|
|
module.exports = factory();
|
|
|
|
|
}else{
|
|
|
|
|
var o = factory();
|
|
|
|
|
for(var i in o){
|
|
|
|
|
root[i] = o[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})(this,function(){
|
|
|
|
|
var ExactDate = (function(){
|
|
|
|
|
return {
|
|
|
|
|
_:function(date,y,m,d){
|
|
|
|
|
if(y<100){
|
|
|
|
|
date.setFullYear(y);
|
|
|
|
|
date.setMonth(m-1);
|
|
|
|
|
date.setDate(d);
|
|
|
|
|
}
|
|
|
|
|
date.setMilliseconds(0);
|
|
|
|
|
return date;
|
|
|
|
|
},
|
|
|
|
|
fromYmd:function(y,m,d){
|
|
|
|
|
return this.fromYmdHms(y,m,d,0,0,0);
|
|
|
|
|
},
|
|
|
|
|
fromYmdHms:function(y,m,d,hour,minute,second){
|
|
|
|
|
return this._(new Date(y+'/'+m+'/'+d+' '+hour+':'+minute+':'+second),y,m,d);
|
|
|
|
|
},
|
|
|
|
|
getDaysBetweenYmd:function(ay, am, ad, by, bm, bd){
|
|
|
|
|
var n;
|
|
|
|
|
var days;
|
|
|
|
|
var i;
|
|
|
|
|
if (ay == by) {
|
|
|
|
|
n = SolarUtil.getDaysInYear(by, bm, bd) - SolarUtil.getDaysInYear(ay, am, ad);
|
|
|
|
|
} else if (ay > by) {
|
|
|
|
|
days = SolarUtil.getDaysOfYear(by) - SolarUtil.getDaysInYear(by, bm, bd);
|
|
|
|
|
for (i = by + 1; i < ay; i++) {
|
|
|
|
|
days += SolarUtil.getDaysOfYear(i);
|
|
|
|
|
}
|
|
|
|
|
days += SolarUtil.getDaysInYear(ay, am, ad);
|
|
|
|
|
n = -days;
|
|
|
|
|
} else {
|
|
|
|
|
days = SolarUtil.getDaysOfYear(ay) - SolarUtil.getDaysInYear(ay, am, ad);
|
|
|
|
|
for (i = ay + 1; i < by; i++) {
|
|
|
|
|
days += SolarUtil.getDaysOfYear(i);
|
|
|
|
|
}
|
|
|
|
|
days += SolarUtil.getDaysInYear(by, bm, bd);
|
|
|
|
|
n = days;
|
|
|
|
|
}
|
|
|
|
|
return n;
|
|
|
|
|
},
|
|
|
|
|
getDaysBetween:function(date0, date1){
|
|
|
|
|
return this.getDaysBetweenYmd(date0.getFullYear(), date0.getMonth() + 1, date0.getDate(), date1.getFullYear(), date1.getMonth() + 1, date1.getDate());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var Solar = (function(){
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
return _fromYmdHms(date.getFullYear(),date.getMonth()+1,date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds());
|
|
|
|
|
};
|
|
|
|
|
var _fromJulianDay = function(julianDay){
|
|
|
|
|
var d = Math.floor(julianDay + 0.5);
|
|
|
|
|
var f = julianDay + 0.5 - d;
|
|
|
|
|
var c;
|
|
|
|
|
|
|
|
|
|
if (d >= 2299161) {
|
|
|
|
|
c = Math.floor((d - 1867216.25) / 36524.25);
|
|
|
|
|
d += 1 + c - Math.floor(c / 4);
|
|
|
|
|
}
|
|
|
|
|
d += 1524;
|
|
|
|
|
var year = Math.floor((d - 122.1) / 365.25);
|
|
|
|
|
d -= Math.floor(365.25 * year);
|
|
|
|
|
var month = Math.floor(d / 30.601);
|
|
|
|
|
d -= Math.floor(30.601 * month);
|
|
|
|
|
var day = d;
|
|
|
|
|
if (month > 13) {
|
|
|
|
|
month -= 13;
|
|
|
|
|
year -= 4715;
|
|
|
|
|
} else {
|
|
|
|
|
month -= 1;
|
|
|
|
|
year -= 4716;
|
|
|
|
|
}
|
|
|
|
|
f *= 24;
|
|
|
|
|
var hour = Math.floor(f);
|
|
|
|
|
|
|
|
|
|
f -= hour;
|
|
|
|
|
f *= 60;
|
|
|
|
|
var minute = Math.floor(f);
|
|
|
|
|
|
|
|
|
|
f -= minute;
|
|
|
|
|
f *= 60;
|
|
|
|
|
var second = Math.round(f);
|
|
|
|
|
if(second>59){
|
|
|
|
|
second-=60;
|
|
|
|
|
minute++;
|
|
|
|
|
}
|
|
|
|
|
if(minute>59){
|
|
|
|
|
minute-=60;
|
|
|
|
|
hour++;
|
|
|
|
|
}
|
|
|
|
|
return _fromYmdHms(year,month,day,hour,minute,second);
|
|
|
|
|
};
|
|
|
|
|
var _fromYmdHms = function(y,m,d,hour,minute,second){
|
|
|
|
|
if(y===1582&&m===10){
|
|
|
|
|
if(d>=15){
|
|
|
|
|
d -= 10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
month:m,
|
|
|
|
|
day:d,
|
|
|
|
|
hour:hour,
|
|
|
|
|
minute:minute,
|
|
|
|
|
second:second,
|
|
|
|
|
calendar:ExactDate.fromYmdHms(y,m,d,hour,minute,second)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){
|
|
|
|
|
return this._p.month;
|
|
|
|
|
},
|
|
|
|
|
getDay:function(){
|
|
|
|
|
return this._p.day;
|
|
|
|
|
},
|
|
|
|
|
getHour:function(){
|
|
|
|
|
return this._p.hour;
|
|
|
|
|
},
|
|
|
|
|
getMinute:function(){
|
|
|
|
|
return this._p.minute;
|
|
|
|
|
},
|
|
|
|
|
getSecond:function(){
|
|
|
|
|
return this._p.second;
|
|
|
|
|
},
|
|
|
|
|
getWeek:function(){
|
|
|
|
|
return this._p.calendar.getDay();
|
|
|
|
|
},
|
|
|
|
|
getWeekInChinese:function(){
|
|
|
|
|
return SolarUtil.WEEK[this.getWeek()];
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取当天的阳历周
|
|
|
|
|
* @param start 星期几作为一周的开始,1234560分别代表星期一至星期天
|
|
|
|
|
*/
|
|
|
|
|
getSolarWeek:function(start){
|
|
|
|
|
return SolarWeek.fromDate(this._p.calendar,start);
|
|
|
|
|
},
|
|
|
|
|
isLeapYear:function(){
|
|
|
|
|
return SolarUtil.isLeapYear(this._p.year);
|
|
|
|
|
},
|
|
|
|
|
getFestivals:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var f = SolarUtil.FESTIVAL[this._p.month+'-'+this._p.day];
|
|
|
|
|
if(f){
|
|
|
|
|
l.push(f);
|
|
|
|
|
}
|
|
|
|
|
var weeks = Math.ceil(this._p.day/7);
|
|
|
|
|
var week = this.getWeek();
|
|
|
|
|
f = SolarUtil.WEEK_FESTIVAL[this._p.month+'-'+weeks+'-'+week];
|
|
|
|
|
if(f){
|
|
|
|
|
l.push(f);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getOtherFestivals:function(){
|
|
|
|
|
var l=[];
|
|
|
|
|
var fs=SolarUtil.OTHER_FESTIVAL[this._p.month+'-'+this._p.day];
|
|
|
|
|
if(fs){
|
|
|
|
|
l=l.concat(fs);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getXingzuo:function(){
|
|
|
|
|
return this.getXingZuo();
|
|
|
|
|
},
|
|
|
|
|
getXingZuo:function(){
|
|
|
|
|
var index = 11;
|
|
|
|
|
var y = this._p.month*100+this._p.day;
|
|
|
|
|
if (y >= 321 && y <= 419) {
|
|
|
|
|
index = 0;
|
|
|
|
|
} else if (y >= 420 && y <= 520) {
|
|
|
|
|
index = 1;
|
|
|
|
|
} else if (y >= 521 && y <= 621) {
|
|
|
|
|
index = 2;
|
|
|
|
|
} else if (y >= 622 && y <= 722) {
|
|
|
|
|
index = 3;
|
|
|
|
|
} else if (y >= 723 && y <= 822) {
|
|
|
|
|
index = 4;
|
|
|
|
|
} else if (y >= 823 && y <= 922) {
|
|
|
|
|
index = 5;
|
|
|
|
|
} else if (y >= 923 && y <= 1023) {
|
|
|
|
|
index = 6;
|
|
|
|
|
} else if (y >= 1024 && y <= 1122) {
|
|
|
|
|
index = 7;
|
|
|
|
|
} else if (y >= 1123 && y <= 1221) {
|
|
|
|
|
index = 8;
|
|
|
|
|
} else if (y >= 1222 || y <= 119) {
|
|
|
|
|
index = 9;
|
|
|
|
|
} else if (y <= 218) {
|
|
|
|
|
index = 10;
|
|
|
|
|
}
|
|
|
|
|
return SolarUtil.XINGZUO[index];
|
|
|
|
|
},
|
|
|
|
|
toYmd:function(){
|
|
|
|
|
var d = this._p.day;
|
|
|
|
|
if(this._p.year===1582&&this._p.month===10){
|
|
|
|
|
if(d>=5){
|
|
|
|
|
d += 10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var y = this._p.year + '';
|
|
|
|
|
while (y.length < 4) {
|
|
|
|
|
y = '0' + y;
|
|
|
|
|
}
|
|
|
|
|
return [y,(this._p.month<10?'0':'')+this._p.month,(d<10?'0':'')+d].join('-');
|
|
|
|
|
},
|
|
|
|
|
toYmdHms:function(){
|
|
|
|
|
return this.toYmd()+' '+[(this._p.hour<10?'0':'')+this._p.hour,(this._p.minute<10?'0':'')+this._p.minute,(this._p.second<10?'0':'')+this._p.second].join(':');
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.toYmd();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var s = this.toYmdHms();
|
|
|
|
|
if(this.isLeapYear()){
|
|
|
|
|
s += ' 闰年';
|
|
|
|
|
}
|
|
|
|
|
s += ' 星期'+this.getWeekInChinese();
|
|
|
|
|
var festivals = this.getFestivals();
|
|
|
|
|
for(var i=0,j=festivals.length;i<j;i++){
|
|
|
|
|
s += ' ('+festivals[i]+')';
|
|
|
|
|
}
|
|
|
|
|
s += ' '+this.getXingZuo()+'座';
|
|
|
|
|
return s;
|
|
|
|
|
},
|
|
|
|
|
next:function(days, onlyWorkday){
|
|
|
|
|
var date = ExactDate.fromYmdHms(this._p.year,this._p.month,this._p.day,this._p.hour,this._p.minute,this._p.second);
|
|
|
|
|
if(0!=days){
|
|
|
|
|
if (!onlyWorkday){
|
|
|
|
|
date.setDate(date.getDate() + days);
|
|
|
|
|
}else{
|
|
|
|
|
var rest = Math.abs(days);
|
|
|
|
|
var add = days < 1 ? -1 : 1;
|
|
|
|
|
while(rest > 0){
|
|
|
|
|
date.setDate(date.getDate() + add);
|
|
|
|
|
var work = true;
|
|
|
|
|
var holiday = HolidayUtil.getHoliday(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
|
|
|
if(!holiday){
|
|
|
|
|
var week = date.getDay();
|
|
|
|
|
if(0 === week || 6 === week){
|
|
|
|
|
work = false;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
work = holiday.isWork();
|
|
|
|
|
}
|
|
|
|
|
if(work){
|
|
|
|
|
rest--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
getLunar:function(){
|
|
|
|
|
return Lunar.fromDate(this._p.calendar);
|
|
|
|
|
},
|
|
|
|
|
getJulianDay:function(){
|
|
|
|
|
var y = this._p.year;
|
|
|
|
|
var m = this._p.month;
|
|
|
|
|
var d = this._p.day + ((this._p.second / 60 + this._p.minute) / 60 + this._p.hour) / 24;
|
|
|
|
|
var n = 0;
|
|
|
|
|
var g = false;
|
|
|
|
|
if (y * 372 + m * 31 + Math.floor(d) >= 588829) {
|
|
|
|
|
g = true;
|
|
|
|
|
}
|
|
|
|
|
if (m <= 2) {
|
|
|
|
|
m += 12;
|
|
|
|
|
y--;
|
|
|
|
|
}
|
|
|
|
|
if (g) {
|
|
|
|
|
n = Math.floor(y / 100);
|
|
|
|
|
n = 2 - n + Math.floor(n / 4);
|
|
|
|
|
}
|
|
|
|
|
return Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + d + n - 1524.5;
|
|
|
|
|
},
|
|
|
|
|
getCalendar:function(){
|
|
|
|
|
return this._p.calendar;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var _fromBaZi=function(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi,sect,baseYear){
|
|
|
|
|
sect = (1==sect)?1:2;
|
|
|
|
|
baseYear = (undefined==baseYear)?1900:baseYear;
|
|
|
|
|
var l = [];
|
|
|
|
|
var today = _fromDate(new Date());
|
|
|
|
|
var lunar = today.getLunar();
|
|
|
|
|
var offsetYear = LunarUtil.getJiaZiIndex(lunar.getYearInGanZhiExact())-LunarUtil.getJiaZiIndex(yearGanZhi);
|
|
|
|
|
if(offsetYear<0){
|
|
|
|
|
offsetYear = offsetYear+60;
|
|
|
|
|
}
|
|
|
|
|
var startYear = lunar.getYear() - offsetYear;
|
|
|
|
|
var hour = 0;
|
|
|
|
|
var timeZhi = timeGanZhi.substr(1);
|
|
|
|
|
for(var i=0,j=LunarUtil.ZHI.length;i<j;i++){
|
|
|
|
|
if(LunarUtil.ZHI[i]===timeZhi){
|
|
|
|
|
hour = (i-1)*2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(startYear>=baseYear){
|
|
|
|
|
var year = startYear-1;
|
|
|
|
|
var counter = 0;
|
|
|
|
|
var month = 12;
|
|
|
|
|
var day;
|
|
|
|
|
var solar;
|
|
|
|
|
var found = false;
|
|
|
|
|
while (counter < 15) {
|
|
|
|
|
if(year>=baseYear){
|
|
|
|
|
day = 1;
|
|
|
|
|
solar = _fromYmdHms(year, month, day, hour, 0, 0);
|
|
|
|
|
lunar = solar.getLunar();
|
|
|
|
|
if(lunar.getYearInGanZhiExact()===yearGanZhi && lunar.getMonthInGanZhiExact()===monthGanZhi){
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
month++;
|
|
|
|
|
if(month > 12){
|
|
|
|
|
month = 1;
|
|
|
|
|
year++;
|
|
|
|
|
}
|
|
|
|
|
counter++;
|
|
|
|
|
}
|
|
|
|
|
if(found){
|
|
|
|
|
counter = 0;
|
|
|
|
|
month--;
|
|
|
|
|
if(month<1){
|
|
|
|
|
month = 12;
|
|
|
|
|
year--;
|
|
|
|
|
}
|
|
|
|
|
day = 1;
|
|
|
|
|
solar = _fromYmdHms(year, month, day, hour, 0, 0);
|
|
|
|
|
while (counter < 61) {
|
|
|
|
|
lunar = solar.getLunar();
|
|
|
|
|
var dgz = (2==sect)?lunar.getDayInGanZhiExact2():lunar.getDayInGanZhiExact();
|
|
|
|
|
if (lunar.getYearInGanZhiExact()===yearGanZhi && lunar.getMonthInGanZhiExact()===monthGanZhi && dgz===dayGanZhi && lunar.getTimeInGanZhi()===timeGanZhi) {
|
|
|
|
|
l.push(solar);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
solar = solar.next(1);
|
|
|
|
|
counter++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
startYear -= 60;
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
J2000:2451545,
|
|
|
|
|
fromYmd:function(y,m,d){return _fromYmdHms(y,m,d,0,0,0);},
|
|
|
|
|
fromYmdHms:function(y,m,d,hour,minute,second){return _fromYmdHms(y,m,d,hour,minute,second);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);},
|
|
|
|
|
fromJulianDay:function(julianDay){return _fromJulianDay(julianDay);},
|
|
|
|
|
fromBaZi:function(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi,sect,baseYear){return _fromBaZi(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi,sect,baseYear);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var Lunar = (function(){
|
|
|
|
|
var _computeJieQi = function(o,ly) {
|
|
|
|
|
o['jieQiList'] = [];
|
|
|
|
|
o['jieQi'] = {};
|
|
|
|
|
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'][key] = Solar.fromJulianDay(julianDays[i]);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var _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']['立春'];
|
|
|
|
|
if (liChun.getYear() != solarYear) {
|
|
|
|
|
liChun = o['jieQi']['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;
|
|
|
|
|
};
|
|
|
|
|
var _computeMonth = function(o,solar){
|
|
|
|
|
var start = null;
|
|
|
|
|
var i;
|
|
|
|
|
var end;
|
|
|
|
|
var size = Lunar.JIE_QI_IN_USE.length;
|
|
|
|
|
|
|
|
|
|
//序号:大雪以前-3,大雪到小寒之间-2,小寒到立春之间-1,立春之后0
|
|
|
|
|
var index = -3;
|
|
|
|
|
for(i=0;i<size;i+=2){
|
|
|
|
|
end = o.jieQi[Lunar.JIE_QI_IN_USE[i]];
|
|
|
|
|
var ymd = solar.toYmd();
|
|
|
|
|
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[Lunar.JIE_QI_IN_USE[i]];
|
|
|
|
|
var time = solar.toYmdHms();
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
var _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;
|
|
|
|
|
};
|
|
|
|
|
var _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;
|
|
|
|
|
};
|
|
|
|
|
var _computeWeek = function(o,solar){
|
|
|
|
|
o['weekIndex'] = solar.getWeek();
|
|
|
|
|
};
|
|
|
|
|
var _compute = function(year,hour,minute,second,solar,ly){
|
|
|
|
|
var o = {};
|
|
|
|
|
_computeJieQi(o, ly);
|
|
|
|
|
_computeYear(o, solar, year);
|
|
|
|
|
_computeMonth(o, solar);
|
|
|
|
|
_computeDay(o, solar, hour, minute);
|
|
|
|
|
_computeTime(o, hour, minute);
|
|
|
|
|
_computeWeek(o, solar);
|
|
|
|
|
return o;
|
|
|
|
|
};
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
var currentYear = date.getFullYear();
|
|
|
|
|
var currentMonth = date.getMonth() + 1;
|
|
|
|
|
var currentDay = date.getDate();
|
|
|
|
|
var lunarYear = 0;
|
|
|
|
|
var lunarMonth = 0;
|
|
|
|
|
var lunarDay = 0;
|
|
|
|
|
var ly = LunarYear.fromYear(currentYear);
|
|
|
|
|
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 = ExactDate.getDaysBetweenYmd(firstDay.getYear(), firstDay.getMonth(), firstDay.getDay(), currentYear, currentMonth, currentDay);
|
|
|
|
|
if (days < m.getDayCount()) {
|
|
|
|
|
lunarYear = m.getYear();
|
|
|
|
|
lunarMonth = m.getMonth();
|
|
|
|
|
lunarDay = days + 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _new(lunarYear, lunarMonth, lunarDay, date.getHours(), date.getMinutes(), date.getSeconds(), Solar.fromDate(date), ly);
|
|
|
|
|
};
|
|
|
|
|
var _fromYmdHms = function(lunarYear,lunarMonth,lunarDay,hour,minute,second) {
|
|
|
|
|
var y = LunarYear.fromYear(lunarYear);
|
|
|
|
|
var m = y.getMonth(lunarMonth);
|
|
|
|
|
if (null == m) {
|
|
|
|
|
throw 'wrong lunar year '+lunarYear+' month '+lunarMonth;
|
|
|
|
|
}
|
|
|
|
|
if (lunarDay < 1) {
|
|
|
|
|
throw 'lunar day must bigger than 0';
|
|
|
|
|
}
|
|
|
|
|
var days = m.getDayCount();
|
|
|
|
|
if (lunarDay > days) {
|
|
|
|
|
throw 'only '+days+' days in lunar year '+lunarYear+' month '+lunarMonth;
|
|
|
|
|
}
|
|
|
|
|
var noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1);
|
|
|
|
|
var solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second);
|
|
|
|
|
return _new(lunarYear, lunarMonth, lunarDay, hour, minute, second, solar, y);
|
|
|
|
|
};
|
|
|
|
|
var _new = function(year,month,day,hour,minute,second,solar,ly){
|
|
|
|
|
var gz = _compute(year,hour,minute,second,solar,ly);
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:year,
|
|
|
|
|
month:month,
|
|
|
|
|
day:day,
|
|
|
|
|
hour:hour,
|
|
|
|
|
minute:minute,
|
|
|
|
|
second:second,
|
|
|
|
|
timeGanIndex:gz.timeGanIndex,
|
|
|
|
|
timeZhiIndex:gz.timeZhiIndex,
|
|
|
|
|
dayGanIndex:gz.dayGanIndex,
|
|
|
|
|
dayZhiIndex:gz.dayZhiIndex,
|
|
|
|
|
dayGanIndexExact:gz.dayGanIndexExact,
|
|
|
|
|
dayZhiIndexExact:gz.dayZhiIndexExact,
|
|
|
|
|
dayGanIndexExact2:gz.dayGanIndexExact2,
|
|
|
|
|
dayZhiIndexExact2:gz.dayZhiIndexExact2,
|
|
|
|
|
monthGanIndex:gz.monthGanIndex,
|
|
|
|
|
monthZhiIndex:gz.monthZhiIndex,
|
|
|
|
|
monthGanIndexExact:gz.monthGanIndexExact,
|
|
|
|
|
monthZhiIndexExact:gz.monthZhiIndexExact,
|
|
|
|
|
yearGanIndex:gz.yearGanIndex,
|
|
|
|
|
yearZhiIndex:gz.yearZhiIndex,
|
|
|
|
|
yearGanIndexByLiChun:gz.yearGanIndexByLiChun,
|
|
|
|
|
yearZhiIndexByLiChun:gz.yearZhiIndexByLiChun,
|
|
|
|
|
yearGanIndexExact:gz.yearGanIndexExact,
|
|
|
|
|
yearZhiIndexExact:gz.yearZhiIndexExact,
|
|
|
|
|
weekIndex:gz.weekIndex,
|
|
|
|
|
jieQi:gz.jieQi,
|
|
|
|
|
jieQiList:gz.jieQiList,
|
|
|
|
|
solar:solar,
|
|
|
|
|
eightChar:null
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){return this._p.year;},
|
|
|
|
|
getMonth:function(){return this._p.month;},
|
|
|
|
|
getDay:function(){return this._p.day;},
|
|
|
|
|
getHour:function(){return this._p.hour;},
|
|
|
|
|
getMinute:function(){return this._p.minute;},
|
|
|
|
|
getSecond:function(){return this._p.second;},
|
|
|
|
|
getTimeGanIndex:function(){return this._p.timeGanIndex;},
|
|
|
|
|
getTimeZhiIndex:function(){return this._p.timeZhiIndex;},
|
|
|
|
|
getDayGanIndex:function(){return this._p.dayGanIndex;},
|
|
|
|
|
getDayGanIndexExact:function(){return this._p.dayGanIndexExact;},
|
|
|
|
|
getDayGanIndexExact2:function(){return this._p.dayGanIndexExact2;},
|
|
|
|
|
getDayZhiIndex:function(){return this._p.dayZhiIndex;},
|
|
|
|
|
getDayZhiIndexExact:function(){return this._p.dayZhiIndexExact;},
|
|
|
|
|
getDayZhiIndexExact2:function(){return this._p.dayZhiIndexExact2;},
|
|
|
|
|
getMonthGanIndex:function(){return this._p.monthGanIndex;},
|
|
|
|
|
getMonthGanIndexExact:function(){return this._p.monthGanIndexExact;},
|
|
|
|
|
getMonthZhiIndex:function(){return this._p.monthZhiIndex;},
|
|
|
|
|
getMonthZhiIndexExact:function(){return this._p.monthZhiIndexExact;},
|
|
|
|
|
getYearGanIndex:function(){return this._p.yearGanIndex;},
|
|
|
|
|
getYearGanIndexByLiChun:function(){return this._p.yearGanIndexByLiChun;},
|
|
|
|
|
getYearGanIndexExact:function(){return this._p.yearGanIndexExact;},
|
|
|
|
|
getYearZhiIndex:function(){return this._p.yearZhiIndex;},
|
|
|
|
|
getYearZhiIndexByLiChun:function(){return this._p.yearZhiIndexByLiChun;},
|
|
|
|
|
getYearZhiIndexExact:function(){return this._p.yearZhiIndexExact;},
|
|
|
|
|
getGan:function(){return this.getYearGan();},
|
|
|
|
|
getZhi:function(){return this.getYearZhi();},
|
|
|
|
|
getYearGan:function(){return LunarUtil.GAN[this._p.yearGanIndex+1];},
|
|
|
|
|
getYearGanByLiChun:function(){return LunarUtil.GAN[this._p.yearGanIndexByLiChun+1];},
|
|
|
|
|
getYearGanExact:function(){return LunarUtil.GAN[this._p.yearGanIndexExact+1];},
|
|
|
|
|
getYearZhi:function(){return LunarUtil.ZHI[this._p.yearZhiIndex+1];},
|
|
|
|
|
getYearZhiByLiChun:function(){return LunarUtil.ZHI[this._p.yearZhiIndexByLiChun+1];},
|
|
|
|
|
getYearZhiExact:function(){return LunarUtil.ZHI[this._p.yearZhiIndexExact+1];},
|
|
|
|
|
getYearInGanZhi:function(){return this.getYearGan()+this.getYearZhi();},
|
|
|
|
|
getYearInGanZhiByLiChun:function(){return this.getYearGanByLiChun()+this.getYearZhiByLiChun();},
|
|
|
|
|
getYearInGanZhiExact:function(){return this.getYearGanExact()+this.getYearZhiExact();},
|
|
|
|
|
getMonthGan:function(){return LunarUtil.GAN[this._p.monthGanIndex+1];},
|
|
|
|
|
getMonthGanExact:function(){return LunarUtil.GAN[this._p.monthGanIndexExact+1];},
|
|
|
|
|
getMonthZhi:function(){return LunarUtil.ZHI[this._p.monthZhiIndex+1];},
|
|
|
|
|
getMonthZhiExact:function(){return LunarUtil.ZHI[this._p.monthZhiIndexExact+1];},
|
|
|
|
|
getMonthInGanZhi:function(){return this.getMonthGan()+this.getMonthZhi();},
|
|
|
|
|
getMonthInGanZhiExact:function(){return this.getMonthGanExact()+this.getMonthZhiExact();},
|
|
|
|
|
getDayGan:function(){return LunarUtil.GAN[this._p.dayGanIndex+1];},
|
|
|
|
|
getDayGanExact:function(){return LunarUtil.GAN[this._p.dayGanIndexExact+1];},
|
|
|
|
|
getDayGanExact2:function(){return LunarUtil.GAN[this._p.dayGanIndexExact2+1];},
|
|
|
|
|
getDayZhi:function(){return LunarUtil.ZHI[this._p.dayZhiIndex+1];},
|
|
|
|
|
getDayZhiExact:function(){return LunarUtil.ZHI[this._p.dayZhiIndexExact+1];},
|
|
|
|
|
getDayZhiExact2:function(){return LunarUtil.ZHI[this._p.dayZhiIndexExact2+1];},
|
|
|
|
|
getDayInGanZhi:function(){return this.getDayGan()+this.getDayZhi();},
|
|
|
|
|
getDayInGanZhiExact:function(){return this.getDayGanExact()+this.getDayZhiExact();},
|
|
|
|
|
getDayInGanZhiExact2:function(){return this.getDayGanExact2()+this.getDayZhiExact2();},
|
|
|
|
|
getTimeGan:function(){return LunarUtil.GAN[this._p.timeGanIndex+1];},
|
|
|
|
|
getTimeZhi:function(){return LunarUtil.ZHI[this._p.timeZhiIndex+1];},
|
|
|
|
|
getTimeInGanZhi:function(){return this.getTimeGan()+this.getTimeZhi();},
|
|
|
|
|
getShengxiao:function(){return this.getYearShengXiao();},
|
|
|
|
|
getYearShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndex+1];},
|
|
|
|
|
getYearShengXiaoByLiChun:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndexByLiChun+1];},
|
|
|
|
|
getYearShengXiaoExact:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndexExact+1];},
|
|
|
|
|
getMonthShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.monthZhiIndex+1];},
|
|
|
|
|
getMonthShengXiaoExact:function(){return LunarUtil.SHENGXIAO[this._p.monthZhiIndexExact+1];},
|
|
|
|
|
getDayShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.dayZhiIndex+1];},
|
|
|
|
|
getTimeShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.timeZhiIndex+1];},
|
|
|
|
|
getYearInChinese:function(){
|
|
|
|
|
var y = this._p.year+'';
|
|
|
|
|
var s = '';
|
|
|
|
|
var zero = '0'.charCodeAt(0);
|
|
|
|
|
for(var i=0,j=y.length;i<j;i++){
|
|
|
|
|
s+=LunarUtil.NUMBER[y.charCodeAt(i)-zero];
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
},
|
|
|
|
|
getMonthInChinese:function(){
|
|
|
|
|
var month = this._p.month;
|
|
|
|
|
return (month<0?'闰':'')+LunarUtil.MONTH[Math.abs(month)];
|
|
|
|
|
},
|
|
|
|
|
getDayInChinese:function(){
|
|
|
|
|
return LunarUtil.DAY[this._p.day];
|
|
|
|
|
},
|
|
|
|
|
getPengZuGan:function(){
|
|
|
|
|
return LunarUtil.PENGZU_GAN[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPengZuZhi:function(){
|
|
|
|
|
return LunarUtil.PENGZU_ZHI[this._p.dayZhiIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionXi:function(){
|
|
|
|
|
return this.getDayPositionXi();
|
|
|
|
|
},
|
|
|
|
|
getPositionXiDesc:function(){
|
|
|
|
|
return this.getDayPositionXiDesc();
|
|
|
|
|
},
|
|
|
|
|
getPositionYangGui:function(){
|
|
|
|
|
return this.getDayPositionYangGui();
|
|
|
|
|
},
|
|
|
|
|
getPositionYangGuiDesc:function(){
|
|
|
|
|
return this.getDayPositionYangGuiDesc();
|
|
|
|
|
},
|
|
|
|
|
getPositionYinGui:function(){
|
|
|
|
|
return this.getDayPositionYinGui();
|
|
|
|
|
},
|
|
|
|
|
getPositionYinGuiDesc:function(){
|
|
|
|
|
return this.getDayPositionYinGuiDesc();
|
|
|
|
|
},
|
|
|
|
|
getPositionFu:function(){
|
|
|
|
|
return this.getDayPositionFu();
|
|
|
|
|
},
|
|
|
|
|
getPositionFuDesc:function(){
|
|
|
|
|
return this.getDayPositionFuDesc();
|
|
|
|
|
},
|
|
|
|
|
getPositionCai:function(){
|
|
|
|
|
return this.getDayPositionCai();
|
|
|
|
|
},
|
|
|
|
|
getPositionCaiDesc:function(){
|
|
|
|
|
return this.getDayPositionCaiDesc();
|
|
|
|
|
},
|
|
|
|
|
getDayPositionXi:function(){
|
|
|
|
|
return LunarUtil.POSITION_XI[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionXiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionXi()];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionYangGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YANG_GUI[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionYangGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionYangGui()];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionYinGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YIN_GUI[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionYinGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionYinGui()];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionFu:function(sect){
|
|
|
|
|
return (1===sect?LunarUtil.POSITION_FU:LunarUtil.POSITION_FU_2)[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionFuDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionFu(sect)];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionCai:function(){
|
|
|
|
|
return LunarUtil.POSITION_CAI[this._p.dayGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionCaiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionCai()];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionXi:function(){
|
|
|
|
|
return LunarUtil.POSITION_XI[this._p.timeGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionXiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getTimePositionXi()];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionYangGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YANG_GUI[this._p.timeGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionYangGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getTimePositionYangGui()];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionYinGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YIN_GUI[this._p.timeGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionYinGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getTimePositionYinGui()];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionFu:function(sect){
|
|
|
|
|
return (1===sect?LunarUtil.POSITION_FU:LunarUtil.POSITION_FU_2)[this._p.timeGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionFuDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getTimePositionFu(sect)];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionCai:function(){
|
|
|
|
|
return LunarUtil.POSITION_CAI[this._p.timeGanIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTimePositionCaiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getTimePositionCai()];
|
|
|
|
|
},
|
|
|
|
|
_getDayPositionTaiSui:function(dayInGanZhi, yearZhiIndex){
|
|
|
|
|
var p = '';
|
|
|
|
|
switch (dayInGanZhi) {
|
|
|
|
|
case '甲子':
|
|
|
|
|
case '乙丑':
|
|
|
|
|
case '丙寅':
|
|
|
|
|
case '丁卯':
|
|
|
|
|
case '戊辰':
|
|
|
|
|
case '已巳':
|
|
|
|
|
p = '震';
|
|
|
|
|
break;
|
|
|
|
|
case '丙子':
|
|
|
|
|
case '丁丑':
|
|
|
|
|
case '戊寅':
|
|
|
|
|
case '已卯':
|
|
|
|
|
case '庚辰':
|
|
|
|
|
case '辛巳':
|
|
|
|
|
p = '离';
|
|
|
|
|
break;
|
|
|
|
|
case '戊子':
|
|
|
|
|
case '已丑':
|
|
|
|
|
case '庚寅':
|
|
|
|
|
case '辛卯':
|
|
|
|
|
case '壬辰':
|
|
|
|
|
case '癸巳':
|
|
|
|
|
p = '中';
|
|
|
|
|
break;
|
|
|
|
|
case '庚子':
|
|
|
|
|
case '辛丑':
|
|
|
|
|
case '壬寅':
|
|
|
|
|
case '癸卯':
|
|
|
|
|
case '甲辰':
|
|
|
|
|
case '乙巳':
|
|
|
|
|
p = '兑';
|
|
|
|
|
break;
|
|
|
|
|
case '壬子':
|
|
|
|
|
case '癸丑':
|
|
|
|
|
case '甲寅':
|
|
|
|
|
case '乙卯':
|
|
|
|
|
case '丙辰':
|
|
|
|
|
case '丁巳':
|
|
|
|
|
p = '坎';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
p = LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
|
|
|
|
|
}
|
|
|
|
|
return p;
|
|
|
|
|
},
|
|
|
|
|
getDayPositionTaiSui:function(sect){
|
|
|
|
|
var dayInGanZhi;
|
|
|
|
|
var yearZhiIndex;
|
|
|
|
|
switch (sect) {
|
|
|
|
|
case 1:
|
|
|
|
|
dayInGanZhi = this.getDayInGanZhi();
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndex;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
dayInGanZhi = this.getDayInGanZhi();
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexExact;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
dayInGanZhi = this.getDayInGanZhiExact2();
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexByLiChun;
|
|
|
|
|
}
|
|
|
|
|
return this._getDayPositionTaiSui(dayInGanZhi, yearZhiIndex);
|
|
|
|
|
},
|
|
|
|
|
getDayPositionTaiSuiDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getDayPositionTaiSui(sect)];
|
|
|
|
|
},
|
|
|
|
|
_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;
|
|
|
|
|
},
|
|
|
|
|
getMonthPositionTaiSui:function(sect){
|
|
|
|
|
var monthZhiIndex;
|
|
|
|
|
var monthGanIndex;
|
|
|
|
|
switch (sect) {
|
|
|
|
|
case 3:
|
|
|
|
|
monthZhiIndex = this._p.monthZhiIndexExact;
|
|
|
|
|
monthGanIndex = this._p.monthGanIndexExact;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
monthZhiIndex = this._p.monthZhiIndex;
|
|
|
|
|
monthGanIndex = this._p.monthGanIndex;
|
|
|
|
|
}
|
|
|
|
|
return this._getMonthPositionTaiSui(monthZhiIndex, monthGanIndex);
|
|
|
|
|
},
|
|
|
|
|
getMonthPositionTaiSuiDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getMonthPositionTaiSui(sect)];
|
|
|
|
|
},
|
|
|
|
|
getYearPositionTaiSui:function(sect){
|
|
|
|
|
var yearZhiIndex;
|
|
|
|
|
switch (sect) {
|
|
|
|
|
case 1:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndex;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexExact;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexByLiChun;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
|
|
|
|
|
},
|
|
|
|
|
getYearPositionTaiSuiDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getYearPositionTaiSui(sect)];
|
|
|
|
|
},
|
|
|
|
|
getChong:function(){
|
|
|
|
|
return this.getDayChong();
|
|
|
|
|
},
|
|
|
|
|
getChongGan:function(){
|
|
|
|
|
return this.getDayChongGan();
|
|
|
|
|
},
|
|
|
|
|
getChongGanTie:function(){
|
|
|
|
|
return this.getDayChongGanTie();
|
|
|
|
|
},
|
|
|
|
|
getChongShengXiao:function(){
|
|
|
|
|
return this.getDayChongShengXiao();
|
|
|
|
|
},
|
|
|
|
|
getChongDesc:function(){
|
|
|
|
|
return this.getDayChongDesc();
|
|
|
|
|
},
|
|
|
|
|
getSha:function(){
|
|
|
|
|
return this.getDaySha();
|
|
|
|
|
},
|
|
|
|
|
getDayChong:function(){
|
|
|
|
|
return LunarUtil.CHONG[this.getDayZhi()];
|
|
|
|
|
},
|
|
|
|
|
getDayChongGan:function(){
|
|
|
|
|
return LunarUtil.CHONG_GAN[this.getDayGan()];
|
|
|
|
|
},
|
|
|
|
|
getDayChongGanTie:function(){
|
|
|
|
|
return LunarUtil.CHONG_GAN_TIE[this.getDayGan()];
|
|
|
|
|
},
|
|
|
|
|
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 '';
|
|
|
|
|
},
|
|
|
|
|
getDayChongDesc:function(){
|
|
|
|
|
return '('+this.getDayChongGan()+this.getDayChong()+')'+this.getDayChongShengXiao();
|
|
|
|
|
},
|
|
|
|
|
getDaySha:function(){
|
|
|
|
|
return LunarUtil.SHA[this.getDayZhi()];
|
|
|
|
|
},
|
|
|
|
|
getTimeChong:function(){
|
|
|
|
|
return LunarUtil.CHONG[this.getTimeZhi()];
|
|
|
|
|
},
|
|
|
|
|
getTimeChongGan:function(){
|
|
|
|
|
return LunarUtil.CHONG_GAN[this.getTimeGan()];
|
|
|
|
|
},
|
|
|
|
|
getTimeChongGanTie:function(){
|
|
|
|
|
return LunarUtil.CHONG_GAN_TIE[this.getTimeGan()];
|
|
|
|
|
},
|
|
|
|
|
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 '';
|
|
|
|
|
},
|
|
|
|
|
getTimeChongDesc:function(){
|
|
|
|
|
return '('+this.getTimeChongGan()+this.getTimeChong()+')'+this.getTimeChongShengXiao();
|
|
|
|
|
},
|
|
|
|
|
getTimeSha:function(){
|
|
|
|
|
return LunarUtil.SHA[this.getTimeZhi()];
|
|
|
|
|
},
|
|
|
|
|
getYearNaYin:function(){
|
|
|
|
|
return LunarUtil.NAYIN[this.getYearInGanZhi()];
|
|
|
|
|
},
|
|
|
|
|
getMonthNaYin:function(){
|
|
|
|
|
return LunarUtil.NAYIN[this.getMonthInGanZhi()];
|
|
|
|
|
},
|
|
|
|
|
getDayNaYin:function(){
|
|
|
|
|
return LunarUtil.NAYIN[this.getDayInGanZhi()];
|
|
|
|
|
},
|
|
|
|
|
getTimeNaYin:function(){
|
|
|
|
|
return LunarUtil.NAYIN[this.getTimeInGanZhi()];
|
|
|
|
|
},
|
|
|
|
|
getSeason:function(){
|
|
|
|
|
return LunarUtil.SEASON[Math.abs(this._p.month)];
|
|
|
|
|
},
|
|
|
|
|
_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;
|
|
|
|
|
},
|
|
|
|
|
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._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._convertJieQi(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
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._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._convertJieQi(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
getJieQi:function(){
|
|
|
|
|
for(var key in this._p.jieQi){
|
|
|
|
|
var d = this._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._convertJieQi(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
getWeek:function(){
|
|
|
|
|
return this._p.weekIndex;
|
|
|
|
|
},
|
|
|
|
|
getWeekInChinese:function(){
|
|
|
|
|
return SolarUtil.WEEK[this.getWeek()];
|
|
|
|
|
},
|
|
|
|
|
getXiu:function(){
|
|
|
|
|
return LunarUtil.XIU[this.getDayZhi()+this.getWeek()];
|
|
|
|
|
},
|
|
|
|
|
getXiuLuck:function(){
|
|
|
|
|
return LunarUtil.XIU_LUCK[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getXiuSong:function(){
|
|
|
|
|
return LunarUtil.XIU_SONG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getZheng:function(){
|
|
|
|
|
return LunarUtil.ZHENG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getAnimal:function(){
|
|
|
|
|
return LunarUtil.ANIMAL[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getGong:function(){
|
|
|
|
|
return LunarUtil.GONG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getShou:function(){
|
|
|
|
|
return LunarUtil.SHOU[this.getGong()];
|
|
|
|
|
},
|
|
|
|
|
getFestivals:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var f = LunarUtil.FESTIVAL[this._p.month+'-'+this._p.day];
|
|
|
|
|
if(f){
|
|
|
|
|
l.push(f);
|
|
|
|
|
}
|
|
|
|
|
if (Math.abs(this._p.month) === 12 && this._p.day >= 29 && this._p.year != this.next(1).getYear()) {
|
|
|
|
|
l.push('除夕');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getOtherFestivals:function(){
|
|
|
|
|
var l=[];
|
|
|
|
|
var fs=LunarUtil.OTHER_FESTIVAL[this._p.month+'-'+this._p.day];
|
|
|
|
|
if(fs){
|
|
|
|
|
l=l.concat(fs);
|
|
|
|
|
}
|
|
|
|
|
if(this._p.solar.toYmd()===this._p.jieQi['清明'].next(-1).toYmd()){
|
|
|
|
|
l.push('寒食节');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
getBaZiShiShenYearZhi:function(){
|
|
|
|
|
return this.getEightChar().getYearShiShenZhi();
|
|
|
|
|
},
|
|
|
|
|
getBaZiShiShenMonthZhi:function(){
|
|
|
|
|
return this.getEightChar().getMonthShiShenZhi();
|
|
|
|
|
},
|
|
|
|
|
getBaZiShiShenDayZhi:function(){
|
|
|
|
|
return this.getEightChar().getDayShiShenZhi();
|
|
|
|
|
},
|
|
|
|
|
getBaZiShiShenTimeZhi:function(){
|
|
|
|
|
return this.getEightChar().getTimeShiShenZhi();
|
|
|
|
|
},
|
|
|
|
|
getZhiXing:function(){
|
|
|
|
|
var offset = this._p.dayZhiIndex-this._p.monthZhiIndex;
|
|
|
|
|
if(offset<0){
|
|
|
|
|
offset += 12;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.ZHI_XING[offset+1];
|
|
|
|
|
},
|
|
|
|
|
getDayTianShen:function(){
|
|
|
|
|
var monthZhi = this.getMonthZhi();
|
|
|
|
|
var offset = LunarUtil.ZHI_TIAN_SHEN_OFFSET[monthZhi];
|
|
|
|
|
return LunarUtil.TIAN_SHEN[(this._p.dayZhiIndex+offset)%12+1];
|
|
|
|
|
},
|
|
|
|
|
getTimeTianShen:function(){
|
|
|
|
|
var dayZhi = this.getDayZhiExact();
|
|
|
|
|
var offset = LunarUtil.ZHI_TIAN_SHEN_OFFSET[dayZhi];
|
|
|
|
|
return LunarUtil.TIAN_SHEN[(this._p.timeZhiIndex+offset)%12+1];
|
|
|
|
|
},
|
|
|
|
|
getDayTianShenType:function(){
|
|
|
|
|
return LunarUtil.TIAN_SHEN_TYPE[this.getDayTianShen()];
|
|
|
|
|
},
|
|
|
|
|
getTimeTianShenType:function(){
|
|
|
|
|
return LunarUtil.TIAN_SHEN_TYPE[this.getTimeTianShen()];
|
|
|
|
|
},
|
|
|
|
|
getDayTianShenLuck:function(){
|
|
|
|
|
return LunarUtil.TIAN_SHEN_TYPE_LUCK[this.getDayTianShenType()];
|
|
|
|
|
},
|
|
|
|
|
getTimeTianShenLuck:function(){
|
|
|
|
|
return LunarUtil.TIAN_SHEN_TYPE_LUCK[this.getTimeTianShenType()];
|
|
|
|
|
},
|
|
|
|
|
getDayPositionTai:function(){
|
|
|
|
|
return LunarUtil.POSITION_TAI_DAY[LunarUtil.getJiaZiIndex(this.getDayInGanZhi())];
|
|
|
|
|
},
|
|
|
|
|
getMonthPositionTai:function(){
|
|
|
|
|
var m = this._p.month;
|
|
|
|
|
if(m<0){
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.POSITION_TAI_MONTH[m-1];
|
|
|
|
|
},
|
|
|
|
|
getDayYi:function(){
|
|
|
|
|
return LunarUtil.getDayYi(this.getMonthInGanZhiExact(),this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getDayJi:function(){
|
|
|
|
|
return LunarUtil.getDayJi(this.getMonthInGanZhiExact(),this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getDayJiShen:function(){
|
|
|
|
|
return LunarUtil.getDayJiShen(this.getMonth(),this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getDayXiongSha:function(){
|
|
|
|
|
return LunarUtil.getDayXiongSha(this.getMonth(),this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getTimeYi:function(){
|
|
|
|
|
return LunarUtil.getTimeYi(this.getDayInGanZhiExact(),this.getTimeInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getTimeJi:function(){
|
|
|
|
|
return LunarUtil.getTimeJi(this.getDayInGanZhiExact(),this.getTimeInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getYueXiang:function(){
|
|
|
|
|
return LunarUtil.YUE_XIANG[this._p.day];
|
|
|
|
|
},
|
|
|
|
|
_getYearNineStar:function(yearInGanZhi){
|
|
|
|
|
var index = LunarUtil.getJiaZiIndex(yearInGanZhi) + 1;
|
|
|
|
|
var yearOffset = 0;
|
|
|
|
|
if (index != LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1) {
|
|
|
|
|
yearOffset = -1;
|
|
|
|
|
}
|
|
|
|
|
var yuan = Math.floor((this._p.year + yearOffset + 2696) / 60) % 3;
|
|
|
|
|
var offset = (62 + yuan * 3 - index) % 9;
|
|
|
|
|
if(0 === offset){
|
|
|
|
|
offset = 9;
|
|
|
|
|
}
|
|
|
|
|
return NineStar.fromIndex(offset - 1);
|
|
|
|
|
},
|
|
|
|
|
getYearNineStar:function(sect){
|
|
|
|
|
var yearInGanZhi;
|
|
|
|
|
switch (sect) {
|
|
|
|
|
case 1:
|
|
|
|
|
yearInGanZhi = this.getYearInGanZhi();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
yearInGanZhi = this.getYearInGanZhiExact();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
yearInGanZhi = this.getYearInGanZhiByLiChun();
|
|
|
|
|
}
|
|
|
|
|
return this._getYearNineStar(yearInGanZhi);
|
|
|
|
|
},
|
|
|
|
|
_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);
|
|
|
|
|
},
|
|
|
|
|
getMonthNineStar:function(sect){
|
|
|
|
|
var yearZhiIndex;
|
|
|
|
|
var monthZhiIndex;
|
|
|
|
|
switch (sect) {
|
|
|
|
|
case 1:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndex;
|
|
|
|
|
monthZhiIndex = this._p.monthZhiIndex;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexExact;
|
|
|
|
|
monthZhiIndex = this._p.monthZhiIndexExact;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
yearZhiIndex = this._p.yearZhiIndexByLiChun;
|
|
|
|
|
monthZhiIndex = this._p.monthZhiIndex;
|
|
|
|
|
}
|
|
|
|
|
return this._getMonthNineStar(yearZhiIndex, monthZhiIndex);
|
|
|
|
|
},
|
|
|
|
|
getDayNineStar:function(){
|
|
|
|
|
var solarYmd = this._p.solar.toYmd();
|
|
|
|
|
var dongZhi = this._p.jieQi['冬至'];
|
|
|
|
|
var dongZhi2 = this._p.jieQi['DONG_ZHI'];
|
|
|
|
|
var xiaZhi = this._p.jieQi['夏至'];
|
|
|
|
|
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 = ExactDate.getDaysBetween(solarShunBai.getCalendar(), this.getSolar().getCalendar()) % 9;
|
|
|
|
|
} else if (solarYmd >= solarNiZiYmd && solarYmd < solarShunBaiYmd2){
|
|
|
|
|
offset = 8 - (ExactDate.getDaysBetween(solarNiZi.getCalendar(), this.getSolar().getCalendar()) % 9);
|
|
|
|
|
} else if (solarYmd >= solarShunBaiYmd2) {
|
|
|
|
|
offset = ExactDate.getDaysBetween(solarShunBai2.getCalendar(), this.getSolar().getCalendar()) % 9;
|
|
|
|
|
} else if (solarYmd < solarShunBaiYmd) {
|
|
|
|
|
offset = (8 + ExactDate.getDaysBetween(this.getSolar().getCalendar(), solarShunBai.getCalendar())) % 9;
|
|
|
|
|
}
|
|
|
|
|
return NineStar.fromIndex(offset);
|
|
|
|
|
},
|
|
|
|
|
getTimeNineStar:function(){
|
|
|
|
|
var solarYmd = this._p.solar.toYmd();
|
|
|
|
|
var asc = false;
|
|
|
|
|
if((solarYmd >= this._p.jieQi['冬至'].toYmd() && solarYmd < this._p.jieQi['夏至'].toYmd()) || solarYmd >= this._p.jieQi['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._p.timeZhiIndex : start + 9 - this._p.timeZhiIndex;
|
|
|
|
|
return NineStar.fromIndex(index % 9);
|
|
|
|
|
},
|
|
|
|
|
getSolar:function(){
|
|
|
|
|
return this._p.solar;
|
|
|
|
|
},
|
|
|
|
|
getJieQiTable:function(){
|
|
|
|
|
return this._p.jieQi;
|
|
|
|
|
},
|
|
|
|
|
getJieQiList:function(){
|
|
|
|
|
return this._p.jieQiList;
|
|
|
|
|
},
|
|
|
|
|
getNextJie:function(wholeDay){
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
getPrevJie:function(wholeDay) {
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
getNextQi:function(wholeDay) {
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
getPrevQi:function(wholeDay) {
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
getNextJieQi:function(wholeDay){return this._getNearJieQi(true, null, wholeDay);},
|
|
|
|
|
getPrevJieQi:function(wholeDay){return this._getNearJieQi(false, null, wholeDay);},
|
|
|
|
|
_buildJieQi:function(name, solar){
|
|
|
|
|
var jie=false;
|
|
|
|
|
var qi=false;
|
|
|
|
|
var i;
|
|
|
|
|
var j;
|
|
|
|
|
for(i=0,j=Lunar.JIE_QI.length;i<j;i++){
|
|
|
|
|
if(Lunar.JIE_QI[i]===name){
|
|
|
|
|
if(i%2==0){
|
|
|
|
|
qi = true;
|
|
|
|
|
}else{
|
|
|
|
|
jie = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
name: name,
|
|
|
|
|
solar: solar,
|
|
|
|
|
jie: jie,
|
|
|
|
|
qi: qi
|
|
|
|
|
},
|
|
|
|
|
getName: function(){return this._p.name;},
|
|
|
|
|
getSolar: function(){return this._p.solar;},
|
|
|
|
|
setName: function(name){this._p.name=name;},
|
|
|
|
|
setSolar: function(solar){this._p.solar=solar;},
|
|
|
|
|
isJie: function(){return this._p.jie;},
|
|
|
|
|
isQi: function(){return this._p.qi;},
|
|
|
|
|
toString: function(){return this.getName();}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
_getNearJieQi:function(forward, conditions, wholeDay){
|
|
|
|
|
var name = null;
|
|
|
|
|
var near = null;
|
|
|
|
|
var filters = {};
|
|
|
|
|
var filter = false;
|
|
|
|
|
if(null!=conditions){
|
|
|
|
|
for(var i=0,j=conditions.length;i<j;i++){
|
|
|
|
|
filters[conditions[i]] = true;
|
|
|
|
|
filter = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var today = this._p.solar[wholeDay ? 'toYmd' : 'toYmdHms']();
|
|
|
|
|
for(var key in this._p.jieQi){
|
|
|
|
|
var jq = this._convertJieQi(key);
|
|
|
|
|
if(filter){
|
|
|
|
|
if(!filters[jq]){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var solar = this._p.jieQi[key];
|
|
|
|
|
var day = solar[wholeDay ? 'toYmd' : 'toYmdHms']();
|
|
|
|
|
if(forward){
|
|
|
|
|
if(day<today){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(null == near || day < near[wholeDay ? 'toYmd' : 'toYmdHms']()){
|
|
|
|
|
name = jq;
|
|
|
|
|
near = solar;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(day>today){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(null == near || day > near[wholeDay ? 'toYmd' : 'toYmdHms']()) {
|
|
|
|
|
name = jq;
|
|
|
|
|
near = solar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(null==near){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return this._buildJieQi(name, near);
|
|
|
|
|
},
|
|
|
|
|
getCurrentJieQi:function(){
|
|
|
|
|
for(var key in this._p.jieQi){
|
|
|
|
|
var d = this._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._buildJieQi(this._convertJieQi(key), d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
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._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._buildJieQi(this._convertJieQi(key), d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
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._p.jieQi[key];
|
|
|
|
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
|
|
|
|
return this._buildJieQi(this._convertJieQi(key), d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
getEightChar:function(){
|
|
|
|
|
if(!this._p.eightChar){
|
|
|
|
|
this._p.eightChar=EightChar.fromLunar(this);
|
|
|
|
|
}
|
|
|
|
|
return this._p.eightChar;
|
|
|
|
|
},
|
|
|
|
|
next:function(days){
|
|
|
|
|
return this._p.solar.next(days).getLunar();
|
|
|
|
|
},
|
|
|
|
|
getYearXun:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getYearInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getMonthXun:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getMonthInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getDayXun:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getTimeXun:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getTimeInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getYearXunByLiChun:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getYearInGanZhiByLiChun());
|
|
|
|
|
},
|
|
|
|
|
getYearXunExact:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getYearInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getMonthXunExact:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getMonthInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getDayXunExact:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getDayInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getDayXunExact2:function(){
|
|
|
|
|
return LunarUtil.getXun(this.getDayInGanZhiExact2());
|
|
|
|
|
},
|
|
|
|
|
getYearXunKong:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getYearInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getMonthXunKong:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getMonthInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getDayXunKong:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getDayInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getTimeXunKong:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getTimeInGanZhi());
|
|
|
|
|
},
|
|
|
|
|
getYearXunKongByLiChun:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getYearInGanZhiByLiChun());
|
|
|
|
|
},
|
|
|
|
|
getYearXunKongExact:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getYearInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getMonthXunKongExact:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getMonthInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getDayXunKongExact:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getDayInGanZhiExact());
|
|
|
|
|
},
|
|
|
|
|
getDayXunKongExact2:function(){
|
|
|
|
|
return LunarUtil.getXunKong(this.getDayInGanZhiExact2());
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYearInChinese()+'年'+this.getMonthInChinese()+'月'+this.getDayInChinese();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var s = this.toString();
|
|
|
|
|
s += ' '+this.getYearInGanZhi()+'('+this.getYearShengXiao()+')年';
|
|
|
|
|
s += ' '+this.getMonthInGanZhi()+'('+this.getMonthShengXiao()+')月';
|
|
|
|
|
s += ' '+this.getDayInGanZhi()+'('+this.getDayShengXiao()+')日';
|
|
|
|
|
s += ' '+this.getTimeZhi()+'('+this.getTimeShengXiao()+')时';
|
|
|
|
|
s += ' 纳音['+this.getYearNaYin()+' '+this.getMonthNaYin()+' '+this.getDayNaYin()+' '+this.getTimeNaYin()+']';
|
|
|
|
|
s += ' 星期'+this.getWeekInChinese();
|
|
|
|
|
var festivals = this.getFestivals();
|
|
|
|
|
var i;
|
|
|
|
|
var j;
|
|
|
|
|
for(i=0,j=festivals.length;i<j;i++){
|
|
|
|
|
s += ' ('+festivals[i]+')';
|
|
|
|
|
}
|
|
|
|
|
festivals = this.getOtherFestivals();
|
|
|
|
|
for(i=0,j=festivals.length;i<j;i++){
|
|
|
|
|
s += ' ('+festivals[i]+')';
|
|
|
|
|
}
|
|
|
|
|
var jq = this.getJieQi();
|
|
|
|
|
if(jq.length>0){
|
|
|
|
|
s += ' ['+jq+']';
|
|
|
|
|
}
|
|
|
|
|
s += ' '+this.getGong()+'方'+this.getShou();
|
|
|
|
|
s += ' 星宿['+this.getXiu()+this.getZheng()+this.getAnimal()+']('+this.getXiuLuck()+')';
|
|
|
|
|
s += ' 彭祖百忌['+this.getPengZuGan()+' '+this.getPengZuZhi()+']';
|
|
|
|
|
s += ' 喜神方位['+this.getDayPositionXi()+']('+this.getDayPositionXiDesc()+')';
|
|
|
|
|
s += ' 阳贵神方位['+this.getDayPositionYangGui()+']('+this.getDayPositionYangGuiDesc()+')';
|
|
|
|
|
s += ' 阴贵神方位['+this.getDayPositionYinGui()+']('+this.getDayPositionYinGuiDesc()+')';
|
|
|
|
|
s += ' 福神方位['+this.getDayPositionFu()+']('+this.getDayPositionFuDesc()+')';
|
|
|
|
|
s += ' 财神方位['+this.getDayPositionCai()+']('+this.getDayPositionCaiDesc()+')';
|
|
|
|
|
s += ' 冲['+this.getDayChongDesc()+']';
|
|
|
|
|
s += ' 煞['+this.getDaySha()+']';
|
|
|
|
|
return s;
|
|
|
|
|
},
|
|
|
|
|
_buildNameAndIndex: function(name, index){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
name: name,
|
|
|
|
|
index: index
|
|
|
|
|
},
|
|
|
|
|
getName: function(){return this._p.name;},
|
|
|
|
|
setName: function(name){this._p.name = name;},
|
|
|
|
|
getIndex: function(){return this._p.index;},
|
|
|
|
|
setIndex: function(index){this._p.index = index;},
|
|
|
|
|
toString: function(){return this.getName();},
|
|
|
|
|
toFullString: function(){return this.getName()+'第'+this.getIndex()+'天';}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
getShuJiu:function(){
|
|
|
|
|
var currentCalendar = ExactDate.fromYmd(this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
|
|
|
|
var start = this._p.jieQi['DONG_ZHI'];
|
|
|
|
|
var startCalendar = ExactDate.fromYmd(start.getYear(),start.getMonth(),start.getDay());
|
|
|
|
|
if (currentCalendar < startCalendar) {
|
|
|
|
|
start = this._p.jieQi['冬至'];
|
|
|
|
|
startCalendar = ExactDate.fromYmd(start.getYear(),start.getMonth(),start.getDay());
|
|
|
|
|
}
|
|
|
|
|
var endCalendar = ExactDate.fromYmd(start.getYear(),start.getMonth(),start.getDay());
|
|
|
|
|
endCalendar.setDate(endCalendar.getDate() + 81);
|
|
|
|
|
if (currentCalendar < startCalendar || currentCalendar >= endCalendar) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
var days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
return this._buildNameAndIndex(LunarUtil.NUMBER[Math.floor(days / 9) + 1] + '九', days % 9 + 1);
|
|
|
|
|
},
|
|
|
|
|
getFu:function(){
|
|
|
|
|
var currentCalendar = ExactDate.fromYmd(this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
|
|
|
|
var xiaZhi = this._p.jieQi['夏至'];
|
|
|
|
|
var liQiu = this._p.jieQi['立秋'];
|
|
|
|
|
var startCalendar = ExactDate.fromYmd(xiaZhi.getYear(),xiaZhi.getMonth(),xiaZhi.getDay());
|
|
|
|
|
|
|
|
|
|
// 第1个庚日
|
|
|
|
|
var add = 6 - xiaZhi.getLunar().getDayGanIndex();
|
|
|
|
|
if (add < 0) {
|
|
|
|
|
add += 10;
|
|
|
|
|
}
|
|
|
|
|
// 第3个庚日,即初伏第1天
|
|
|
|
|
add += 20;
|
|
|
|
|
startCalendar.setDate(startCalendar.getDate() + add);
|
|
|
|
|
|
|
|
|
|
// 初伏以前
|
|
|
|
|
if (currentCalendar < startCalendar) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
if (days < 10) {
|
|
|
|
|
return this._buildNameAndIndex('初伏', days + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 第4个庚日,中伏第1天
|
|
|
|
|
startCalendar.setDate(startCalendar.getDate() + 10);
|
|
|
|
|
|
|
|
|
|
days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
if (days < 10) {
|
|
|
|
|
return this._buildNameAndIndex('中伏', days + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 第5个庚日,中伏第11天或末伏第1天
|
|
|
|
|
startCalendar.setDate(startCalendar.getDate() + 10);
|
|
|
|
|
|
|
|
|
|
var liQiuCalendar = ExactDate.fromYmd(liQiu.getYear(),liQiu.getMonth(),liQiu.getDay());
|
|
|
|
|
|
|
|
|
|
days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
// 末伏
|
|
|
|
|
if (liQiuCalendar <= startCalendar) {
|
|
|
|
|
if (days < 10) {
|
|
|
|
|
return this._buildNameAndIndex('末伏', days + 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 中伏
|
|
|
|
|
if (days < 10) {
|
|
|
|
|
return this._buildNameAndIndex('中伏', days + 11);
|
|
|
|
|
}
|
|
|
|
|
// 末伏第1天
|
|
|
|
|
startCalendar.setDate(startCalendar.getDate() + 10);
|
|
|
|
|
days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
if (days < 10) {
|
|
|
|
|
return this._buildNameAndIndex('末伏', days + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
getLiuYao:function(){
|
|
|
|
|
return LunarUtil.LIU_YAO[(Math.abs(this._p.month)+this._p.day-2)%6];
|
|
|
|
|
},
|
|
|
|
|
getWuHou:function(){
|
|
|
|
|
var jieQi = this.getPrevJieQi(true);
|
|
|
|
|
var name = jieQi.getName();
|
|
|
|
|
var offset = 0;
|
|
|
|
|
for(var i=0,j=Lunar.JIE_QI.length;i<j;i++){
|
|
|
|
|
if(name === Lunar.JIE_QI[i]){
|
|
|
|
|
offset = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var currentCalendar = ExactDate.fromYmd(this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
|
|
|
|
var startSolar = jieQi.getSolar();
|
|
|
|
|
var startCalendar = ExactDate.fromYmd(startSolar.getYear(),startSolar.getMonth(),startSolar.getDay());
|
|
|
|
|
var days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
|
|
|
|
return LunarUtil.WU_HOU[(offset*3+Math.floor(days/5)) % LunarUtil.WU_HOU.length];
|
|
|
|
|
},
|
|
|
|
|
getHou:function(){
|
|
|
|
|
var jieQi = this.getPrevJieQi(true);
|
|
|
|
|
var name = jieQi.getName();
|
|
|
|
|
var startSolar = jieQi.getSolar();
|
|
|
|
|
var days = ExactDate.getDaysBetweenYmd(startSolar.getYear(),startSolar.getMonth(),startSolar.getDay(), this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
|
|
|
|
var max = LunarUtil.HOU.length - 1;
|
|
|
|
|
var offset = Math.floor(days / 5);
|
|
|
|
|
if (offset > max) {
|
|
|
|
|
offset = max;
|
|
|
|
|
}
|
|
|
|
|
return name + ' ' + LunarUtil.HOU[offset];
|
|
|
|
|
},
|
|
|
|
|
getDayLu:function(){
|
|
|
|
|
var gan = LunarUtil.LU[this.getDayGan()];
|
|
|
|
|
var zhi = LunarUtil.LU[this.getDayZhi()];
|
|
|
|
|
var lu = gan + '命互禄';
|
|
|
|
|
if (zhi) {
|
|
|
|
|
lu += ' ' + zhi + '命进禄';
|
|
|
|
|
}
|
|
|
|
|
return lu;
|
|
|
|
|
},
|
|
|
|
|
getTimes:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
l.push(LunarTime.fromYmdHms(this._p.year, this._p.month, this._p.day, 0, 0, 0));
|
|
|
|
|
for(var i = 0; i < 12; i++){
|
|
|
|
|
l.push(LunarTime.fromYmdHms(this._p.year, this._p.month, this._p.day, (i+1)*2-1, 0, 0));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getFoto:function(){return Foto.fromLunar(this);},
|
|
|
|
|
getTao:function(){return Tao.fromLunar(this);}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
JIE_QI: ['冬至','小寒','大寒','立春','雨水','惊蛰','春分','清明','谷雨','立夏','小满','芒种','夏至','小暑','大暑','立秋','处暑','白露','秋分','寒露','霜降','立冬','小雪','大雪'],
|
|
|
|
|
JIE_QI_IN_USE: ['DA_XUE', '冬至', '小寒', '大寒', '立春', '雨水', '惊蛰', '春分', '清明', '谷雨', '立夏', '小满', '芒种', '夏至', '小暑', '大暑', '立秋', '处暑', '白露', '秋分', '寒露', '霜降', '立冬', '小雪', '大雪', 'DONG_ZHI', 'XIAO_HAN', 'DA_HAN', 'LI_CHUN', 'YU_SHUI', 'JING_ZHE'],
|
|
|
|
|
fromYmdHms:function(y,m,d,hour,minute,second){return _fromYmdHms(y,m,d,hour,minute,second);},
|
|
|
|
|
fromYmd:function(y,m,d){return _fromYmdHms(y,m,d,0,0,0);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarWeek = (function(){
|
|
|
|
|
var _fromDate = function(date,start){
|
|
|
|
|
return _fromYmd(date.getFullYear(),date.getMonth()+1,date.getDate(),start);
|
|
|
|
|
};
|
|
|
|
|
var _fromYmd = function(y,m,d,start){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
month:m,
|
|
|
|
|
day:d,
|
|
|
|
|
start:start,
|
|
|
|
|
calendar:ExactDate.fromYmd(y,m,d)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){
|
|
|
|
|
return this._p.month;
|
|
|
|
|
},
|
|
|
|
|
getDay:function(){
|
|
|
|
|
return this._p.day;
|
|
|
|
|
},
|
|
|
|
|
getStart:function(){
|
|
|
|
|
return this._p.start;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前日期是在当月第几周
|
|
|
|
|
* @return number 周序号,从1开始
|
|
|
|
|
*/
|
|
|
|
|
getIndex:function(){
|
|
|
|
|
var firstDate = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
|
|
|
|
var firstDayWeek = firstDate.getDay();
|
|
|
|
|
var offset = firstDayWeek - this._p.start;
|
|
|
|
|
if(offset < 0) {
|
|
|
|
|
offset += 7;
|
|
|
|
|
}
|
|
|
|
|
return Math.ceil((this._p.day + offset)/7);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 周推移
|
|
|
|
|
* @param weeks 推移的周数,负数为倒推
|
|
|
|
|
* @param separateMonth 是否按月单独计算
|
|
|
|
|
* @return object 推移后的阳历周
|
|
|
|
|
*/
|
|
|
|
|
next:function(weeks,separateMonth){
|
|
|
|
|
if(0===weeks){
|
|
|
|
|
return _fromYmd(this._p.year,this._p.month,this._p.day,this._p.start);
|
|
|
|
|
}
|
|
|
|
|
var date;
|
|
|
|
|
if(separateMonth){
|
|
|
|
|
var n = weeks;
|
|
|
|
|
date = ExactDate.fromYmd(this._p.year,this._p.month,this._p.day);
|
|
|
|
|
var week = _fromDate(date,this._p.start);
|
|
|
|
|
var month = this._p.month;
|
|
|
|
|
var plus = n>0;
|
|
|
|
|
while(0!==n){
|
|
|
|
|
date.setDate(date.getDate()+(plus?7:-7));
|
|
|
|
|
week = _fromDate(date,this._p.start);
|
|
|
|
|
var weekMonth = week.getMonth();
|
|
|
|
|
if(month!==weekMonth){
|
|
|
|
|
var index = week.getIndex();
|
|
|
|
|
if(plus){
|
|
|
|
|
if(1===index){
|
|
|
|
|
var firstDay = week.getFirstDay();
|
|
|
|
|
week = _fromYmd(firstDay.getYear(),firstDay.getMonth(),firstDay.getDay(),this._p.start);
|
|
|
|
|
weekMonth = week.getMonth();
|
|
|
|
|
}else{
|
|
|
|
|
date = ExactDate.fromYmd(week.getYear(),week.getMonth(),1);
|
|
|
|
|
week = _fromDate(date,this._p.start);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
var size = SolarUtil.getWeeksOfMonth(week.getYear(),week.getMonth(),this._p.start);
|
|
|
|
|
if(size===index){
|
|
|
|
|
var lastDay = week.getFirstDay().next(6);
|
|
|
|
|
week = _fromYmd(lastDay.getYear(),lastDay.getMonth(),lastDay.getDay(),this._p.start);
|
|
|
|
|
weekMonth = week.getMonth();
|
|
|
|
|
}else{
|
|
|
|
|
date = ExactDate.fromYmd(week.getYear(),week.getMonth(),SolarUtil.getDaysOfMonth(week.getYear(),week.getMonth()));
|
|
|
|
|
week = _fromDate(date,this._p.start);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
month = weekMonth;
|
|
|
|
|
}
|
|
|
|
|
n-=plus?1:-1;
|
|
|
|
|
}
|
|
|
|
|
return week;
|
|
|
|
|
}else{
|
|
|
|
|
date = ExactDate.fromYmd(this._p.year,this._p.month,this._p.day);
|
|
|
|
|
date.setDate(date.getDate()+weeks*7);
|
|
|
|
|
return _fromDate(date,this._p.start);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本周第一天的阳历日期(可能跨月)
|
|
|
|
|
* @return object 本周第一天的阳历日期
|
|
|
|
|
*/
|
|
|
|
|
getFirstDay:function(){
|
|
|
|
|
var date = ExactDate.fromYmd(this._p.year,this._p.month,this._p.day);
|
|
|
|
|
var prev = date.getDay()-this._p.start;
|
|
|
|
|
if(prev<0){
|
|
|
|
|
prev += 7;
|
|
|
|
|
}
|
|
|
|
|
date.setDate(date.getDate()-prev);
|
|
|
|
|
return Solar.fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本周第一天的阳历日期(仅限当月)
|
|
|
|
|
* @return object 本周第一天的阳历日期
|
|
|
|
|
*/
|
|
|
|
|
getFirstDayInMonth:function(){
|
|
|
|
|
var index = 0;
|
|
|
|
|
var days = this.getDays();
|
|
|
|
|
for(var i = 0;i<days.length;i++){
|
|
|
|
|
if(this._p.month===days[i].getMonth()){
|
|
|
|
|
index = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return days[index];
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本周的阳历日期列表(可能跨月)
|
|
|
|
|
* @return Array 本周的阳历日期列表
|
|
|
|
|
*/
|
|
|
|
|
getDays:function(){
|
|
|
|
|
var firstDay = this.getFirstDay();
|
|
|
|
|
var l = [];
|
|
|
|
|
l.push(firstDay);
|
|
|
|
|
for(var i = 1;i<7;i++){
|
|
|
|
|
l.push(firstDay.next(i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本周的阳历日期列表(仅限当月)
|
|
|
|
|
* @return Array 本周的阳历日期列表(仅限当月)
|
|
|
|
|
*/
|
|
|
|
|
getDaysInMonth:function(){
|
|
|
|
|
var days = this.getDays();
|
|
|
|
|
var l = [];
|
|
|
|
|
for(var i = 0;i<days.length;i++){
|
|
|
|
|
var day = days[i];
|
|
|
|
|
if(this._p.month!==day.getMonth()){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
l.push(day);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'.'+this.getMonth()+'.'+this.getIndex();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年'+this.getMonth()+'月第'+this.getIndex()+'周';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
/**
|
|
|
|
|
* 指定年月日生成当天所在的阳历周
|
|
|
|
|
* @param y 年份
|
|
|
|
|
* @param m 月份
|
|
|
|
|
* @param d 日期
|
|
|
|
|
* @param start 星期几作为一周的开始,1234560分别代表星期一至星期天
|
|
|
|
|
* @return object 阳历周
|
|
|
|
|
*/
|
|
|
|
|
fromYmd:function(y,m,d,start){return _fromYmd(y,m,d,start);},
|
|
|
|
|
/**
|
|
|
|
|
* 指定日期生成当天所在的阳历周
|
|
|
|
|
* @param date 日期
|
|
|
|
|
* @param start 星期几作为一周的开始,1234560分别代表星期一至星期天
|
|
|
|
|
* @return object 阳历周
|
|
|
|
|
*/
|
|
|
|
|
fromDate:function(date,start){return _fromDate(date,start);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarMonth = (function(){
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
return _fromYm(date.getFullYear(),date.getMonth()+1);
|
|
|
|
|
};
|
|
|
|
|
var _fromYm = function(y,m){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
month:m,
|
|
|
|
|
calendar:ExactDate.fromYmd(y,m,1)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){
|
|
|
|
|
return this._p.month;
|
|
|
|
|
},
|
|
|
|
|
next:function(months){
|
|
|
|
|
var date = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
|
|
|
|
date.setMonth(date.getMonth()+months);
|
|
|
|
|
return _fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
getDays:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var d = Solar.fromYmd(this._p.year,this._p.month,1);
|
|
|
|
|
l.push(d);
|
|
|
|
|
var days = SolarUtil.getDaysOfMonth(this._p.year,this._p.month);
|
|
|
|
|
for(var i = 1;i<days;i++){
|
|
|
|
|
l.push(d.next(i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getWeeks:function(start){
|
|
|
|
|
var l = [];
|
|
|
|
|
var weeks = SolarUtil.getWeeksOfMonth(this._p.year,this._p.month,start);
|
|
|
|
|
for(var i = 0;i<weeks;i++){
|
|
|
|
|
l.push(SolarWeek.fromYmd(this._p.year,this._p.month,1+i*7,start));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'-'+this.getMonth();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年'+this.getMonth()+'月';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYm:function(y,m){return _fromYm(y,m);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarSeason = (function(){
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
return _fromYm(date.getFullYear(),date.getMonth()+1);
|
|
|
|
|
};
|
|
|
|
|
var _fromYm = function(y,m){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
month:m,
|
|
|
|
|
calendar:ExactDate.fromYmd(y,m,1)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){
|
|
|
|
|
return this._p.month;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取当月是第几季度
|
|
|
|
|
* @return number 季度序号,从1开始
|
|
|
|
|
*/
|
|
|
|
|
getIndex:function(){
|
|
|
|
|
return Math.ceil(this._p.month/3);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 季度推移
|
|
|
|
|
* @param seasons 推移的季度数,负数为倒推
|
|
|
|
|
* @return object 推移后的季度
|
|
|
|
|
*/
|
|
|
|
|
next:function(seasons){
|
|
|
|
|
if(0===seasons){
|
|
|
|
|
return _fromYm(this._p.year,this._p.month);
|
|
|
|
|
}
|
|
|
|
|
var date = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
|
|
|
|
date.setMonth(date.getMonth()+3*seasons);
|
|
|
|
|
return _fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本季度的月份
|
|
|
|
|
* @return Array 本季度的月份列表
|
|
|
|
|
*/
|
|
|
|
|
getMonths:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var index = this.getIndex()-1;
|
|
|
|
|
for(var i=0;i<3;i++){
|
|
|
|
|
l.push(SolarMonth.fromYm(this._p.year,3*index+i+1));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'.'+this.getIndex();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年'+this.getIndex()+'季度';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYm:function(y,m){return _fromYm(y,m);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarHalfYear = (function(){
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
return _fromYm(date.getFullYear(),date.getMonth()+1);
|
|
|
|
|
};
|
|
|
|
|
var _fromYm = function(y,m){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
month:m,
|
|
|
|
|
calendar:ExactDate.fromYmd(y,m,1)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){
|
|
|
|
|
return this._p.month;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取当月是第几半年
|
|
|
|
|
* @return number 半年序号,从1开始
|
|
|
|
|
*/
|
|
|
|
|
getIndex:function(){
|
|
|
|
|
return Math.ceil(this._p.month/6);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 半年推移
|
|
|
|
|
* @param halfYears 推移的半年数,负数为倒推
|
|
|
|
|
* @return object 推移后的半年
|
|
|
|
|
*/
|
|
|
|
|
next:function(halfYears){
|
|
|
|
|
if(0===halfYears){
|
|
|
|
|
return _fromYm(this._p.year,this._p.month);
|
|
|
|
|
}
|
|
|
|
|
var date = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
|
|
|
|
date.setMonth(date.getMonth()+6*halfYears);
|
|
|
|
|
return _fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取本半年的月份
|
|
|
|
|
* @return Array 本半年的月份列表
|
|
|
|
|
*/
|
|
|
|
|
getMonths:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var index = this.getIndex()-1;
|
|
|
|
|
for(var i=0;i<6;i++){
|
|
|
|
|
l.push(SolarMonth.fromYm(this._p.year,6*index+i+1));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'.'+this.getIndex();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年'+['上','下'][this.getIndex()-1]+'半年';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYm:function(y,m){return _fromYm(y,m);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarYear = (function(){
|
|
|
|
|
var _fromDate = function(date){
|
|
|
|
|
return _fromYear(date.getFullYear());
|
|
|
|
|
};
|
|
|
|
|
var _fromYear = function(y){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
year:y,
|
|
|
|
|
calendar:ExactDate.fromYmd(y,1,1)
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.year;
|
|
|
|
|
},
|
|
|
|
|
next:function(years){
|
|
|
|
|
var date = ExactDate.fromYmd(this._p.year,1,1);
|
|
|
|
|
date.setFullYear(date.getFullYear()+years);
|
|
|
|
|
return _fromDate(date);
|
|
|
|
|
},
|
|
|
|
|
getMonths:function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
var m = SolarMonth.fromYm(this._p.year,1);
|
|
|
|
|
l.push(m);
|
|
|
|
|
for(var i = 1;i<12;i++){
|
|
|
|
|
l.push(m.next(i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'';
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYear:function(y){return _fromYear(y);},
|
|
|
|
|
fromDate:function(date){return _fromDate(date);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var LunarYear = (function(){
|
|
|
|
|
var _YUAN = ['下','上','中'];
|
|
|
|
|
var _YUN = ['七','八','九','一','二','三','四','五','六'];
|
|
|
|
|
var _LEAP_11 = [75, 94, 170, 238, 265, 322, 389, 469, 553, 583, 610, 678, 735, 754, 773, 849, 887, 936, 1050, 1069, 1126, 1145, 1164, 1183, 1259, 1278, 1308, 1373, 1403, 1441, 1460, 1498, 1555, 1593, 1612, 1631, 1642, 2033, 2128, 2147, 2242, 2614, 2728, 2910, 3062, 3244, 3339, 3616, 3711, 3730, 3825, 4007, 4159, 4197, 4322, 4341, 4379, 4417, 4531, 4599, 4694, 4713, 4789, 4808, 4971, 5085, 5104, 5161, 5180, 5199, 5294, 5305, 5476, 5677, 5696, 5772, 5791, 5848, 5886, 6049, 6068, 6144, 6163, 6258, 6402, 6440, 6497, 6516, 6630, 6641, 6660, 6679, 6736, 6774, 6850, 6869, 6899, 6918, 6994, 7013, 7032, 7051, 7070, 7089, 7108, 7127, 7146, 7222, 7271, 7290, 7309, 7366, 7385, 7404, 7442, 7461, 7480, 7491, 7499, 7594, 7624, 7643, 7662, 7681, 7719, 7738, 7814, 7863, 7882, 7901, 7939, 7958, 7977, 7996, 8034, 8053, 8072, 8091, 8121, 8159, 8186, 8216, 8235, 8254, 8273, 8311, 8330, 8341, 8349, 8368, 8444, 8463, 8474, 8493, 8531, 8569, 8588, 8626, 8664, 8683, 8694, 8702, 8713, 8721, 8751, 8789, 8808, 8816, 8827, 8846, 8884, 8903, 8922, 8941, 8971, 9036, 9066, 9085, 9104, 9123, 9142, 9161, 9180, 9199, 9218, 9256, 9294, 9313, 9324, 9343, 9362, 9381, 9419, 9438, 9476, 9514, 9533, 9544, 9552, 9563, 9571, 9582, 9601, 9639, 9658, 9666, 9677, 9696, 9734, 9753, 9772, 9791, 9802, 9821, 9886, 9897, 9916, 9935, 9954, 9973, 9992];
|
|
|
|
|
var _LEAP_12 = [37, 56, 113, 132, 151, 189, 208, 227, 246, 284, 303, 341, 360, 379, 417, 436, 458, 477, 496, 515, 534, 572, 591, 629, 648, 667, 697, 716, 792, 811, 830, 868, 906, 925, 944, 963, 982, 1001, 1020, 1039, 1058, 1088, 1153, 1202, 1221, 1240, 1297, 1335, 1392, 1411, 1422, 1430, 1517, 1525, 1536, 1574, 3358, 3472, 3806, 3988, 4751, 4941, 5066, 5123, 5275, 5343, 5438, 5457, 5495, 5533, 5552, 5715, 5810, 5829, 5905, 5924, 6421, 6535, 6793, 6812, 6888, 6907, 7002, 7184, 7260, 7279, 7374, 7556, 7746, 7757, 7776, 7833, 7852, 7871, 7966, 8015, 8110, 8129, 8148, 8224, 8243, 8338, 8406, 8425, 8482, 8501, 8520, 8558, 8596, 8607, 8615, 8645, 8740, 8778, 8835, 8865, 8930, 8960, 8979, 8998, 9017, 9055, 9074, 9093, 9112, 9150, 9188, 9237, 9275, 9332, 9351, 9370, 9408, 9427, 9446, 9457, 9465, 9495, 9560, 9590, 9628, 9647, 9685, 9715, 9742, 9780, 9810, 9818, 9829, 9848, 9867, 9905, 9924, 9943, 9962, 10000];
|
|
|
|
|
var _LEAP = {};
|
|
|
|
|
var _CACHE = {};
|
|
|
|
|
var _initLeap = function() {
|
|
|
|
|
var i;
|
|
|
|
|
var j;
|
|
|
|
|
for (i = 0, j = _LEAP_11.length; i < j; i++) {
|
|
|
|
|
_LEAP['_' + _LEAP_11[i]] = 13;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0, j = _LEAP_12.length; i < j; i++) {
|
|
|
|
|
_LEAP['_' + _LEAP_12[i]] = 14;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
_initLeap();
|
|
|
|
|
var _fromYear = function(lunarYear){
|
|
|
|
|
var _y = (function(){
|
|
|
|
|
var offset = lunarYear - 4;
|
|
|
|
|
var yearGanIndex = offset % 10;
|
|
|
|
|
var yearZhiIndex = offset % 12;
|
|
|
|
|
if (yearGanIndex < 0) {
|
|
|
|
|
yearGanIndex += 10;
|
|
|
|
|
}
|
|
|
|
|
if (yearZhiIndex < 0) {
|
|
|
|
|
yearZhiIndex += 12;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
ganIndex: yearGanIndex,
|
|
|
|
|
zhiIndex: yearZhiIndex
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
year: lunarYear,
|
|
|
|
|
ganIndex: _y.ganIndex,
|
|
|
|
|
zhiIndex: _y.zhiIndex,
|
|
|
|
|
months: [],
|
|
|
|
|
jieQiJulianDays: []
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){return this._p.year;},
|
|
|
|
|
getGanIndex:function(){return this._p.ganIndex;},
|
|
|
|
|
getZhiIndex:function(){return this._p.zhiIndex;},
|
|
|
|
|
getGan:function(){return LunarUtil.GAN[this._p.ganIndex+1];},
|
|
|
|
|
getZhi:function(){return LunarUtil.ZHI[this._p.zhiIndex+1];},
|
|
|
|
|
getGanZhi:function(){return this.getGan()+this.getZhi();},
|
|
|
|
|
getJieQiJulianDays:function(){return this._p.jieQiJulianDays;},
|
|
|
|
|
getMonths:function(){return this._p.months;},
|
|
|
|
|
getMonth:function(lunarMonth){
|
|
|
|
|
for (var i = 0, j = this._p.months.length; i < j; i++) {
|
|
|
|
|
var m = this._p.months[i];
|
|
|
|
|
if (m.getYear() === this._p.year && m.getMonth() === lunarMonth) {
|
|
|
|
|
return m;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
getLeapMonth:function(){
|
|
|
|
|
for (var i = 0, j = this._p.months.length; i < j; i++) {
|
|
|
|
|
var m = this._p.months[i];
|
|
|
|
|
if (m.getYear() === this._p.year && m.isLeap()) {
|
|
|
|
|
return Math.abs(m.getMonth());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
},
|
|
|
|
|
_getZaoByGan:function(index, name){
|
|
|
|
|
var offset = index - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayGanIndex();
|
|
|
|
|
if (offset < 0) {
|
|
|
|
|
offset += 10;
|
|
|
|
|
}
|
|
|
|
|
return name.replace('几', LunarUtil.NUMBER[offset+1]);
|
|
|
|
|
},
|
|
|
|
|
_getZaoByZhi:function(index, name){
|
|
|
|
|
var offset = index - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex();
|
|
|
|
|
if (offset < 0) {
|
|
|
|
|
offset += 12;
|
|
|
|
|
}
|
|
|
|
|
return name.replace('几', LunarUtil.NUMBER[offset+1]);
|
|
|
|
|
},
|
|
|
|
|
getTouLiang:function(){
|
|
|
|
|
return this._getZaoByZhi(0, '几鼠偷粮');
|
|
|
|
|
},
|
|
|
|
|
getCaoZi:function(){
|
|
|
|
|
return this._getZaoByZhi(0, '草子几分');
|
|
|
|
|
},
|
|
|
|
|
getGengTian:function(){
|
|
|
|
|
return this._getZaoByZhi(1, '几牛耕田');
|
|
|
|
|
},
|
|
|
|
|
getHuaShou:function(){
|
|
|
|
|
return this._getZaoByZhi(3, '花收几分');
|
|
|
|
|
},
|
|
|
|
|
getZhiShui:function(){
|
|
|
|
|
return this._getZaoByZhi(4, '几龙治水');
|
|
|
|
|
},
|
|
|
|
|
getTuoGu:function(){
|
|
|
|
|
return this._getZaoByZhi(6, '几马驮谷');
|
|
|
|
|
},
|
|
|
|
|
getQiangMi:function(){
|
|
|
|
|
return this._getZaoByZhi(9, '几鸡抢米');
|
|
|
|
|
},
|
|
|
|
|
getKanCan:function(){
|
|
|
|
|
return this._getZaoByZhi(9, '几姑看蚕');
|
|
|
|
|
},
|
|
|
|
|
getGongZhu:function(){
|
|
|
|
|
return this._getZaoByZhi(11, '几屠共猪');
|
|
|
|
|
},
|
|
|
|
|
getJiaTian:function(){
|
|
|
|
|
return this._getZaoByGan(0, '甲田几分');
|
|
|
|
|
},
|
|
|
|
|
getFenBing:function(){
|
|
|
|
|
return this._getZaoByGan(2, '几人分饼');
|
|
|
|
|
},
|
|
|
|
|
getDeJin:function(){
|
|
|
|
|
return this._getZaoByGan(7, '几日得金');
|
|
|
|
|
},
|
|
|
|
|
getRenBing:function(){
|
|
|
|
|
return this._getZaoByGan(2, this._getZaoByZhi(2, '几人几丙'));
|
|
|
|
|
},
|
|
|
|
|
getRenChu:function(){
|
|
|
|
|
return this._getZaoByGan(3, this._getZaoByZhi(2, '几人几锄'));
|
|
|
|
|
},
|
|
|
|
|
getYuan:function(){
|
|
|
|
|
return _YUAN[Math.floor((this._p.year+2696)/60)%3]+'元';
|
|
|
|
|
},
|
|
|
|
|
getYun:function(){
|
|
|
|
|
return _YUN[Math.floor((this._p.year+2696)/20)%9]+'运';
|
|
|
|
|
},
|
|
|
|
|
getNineStar:function(){
|
|
|
|
|
var index = LunarUtil.getJiaZiIndex(this.getGanZhi()) + 1;
|
|
|
|
|
var yuan = Math.floor((this._p.year + 2696) / 60) % 3;
|
|
|
|
|
var offset = (62 + yuan * 3 - index) % 9;
|
|
|
|
|
if(0 === offset){
|
|
|
|
|
offset = 9;
|
|
|
|
|
}
|
|
|
|
|
return NineStar.fromIndex(offset - 1);
|
|
|
|
|
},
|
|
|
|
|
getPositionXi:function(){
|
|
|
|
|
return LunarUtil.POSITION_XI[this._p.ganIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionXiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionXi()];
|
|
|
|
|
},
|
|
|
|
|
getPositionYangGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YANG_GUI[this._p.ganIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionYangGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionYangGui()];
|
|
|
|
|
},
|
|
|
|
|
getPositionYinGui:function(){
|
|
|
|
|
return LunarUtil.POSITION_YIN_GUI[this._p.ganIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionYinGuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionYinGui()];
|
|
|
|
|
},
|
|
|
|
|
getPositionFu:function(sect){
|
|
|
|
|
return (1===sect?LunarUtil.POSITION_FU:LunarUtil.POSITION_FU_2)[this._p.ganIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionFuDesc:function(sect){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionFu(sect)];
|
|
|
|
|
},
|
|
|
|
|
getPositionCai:function(){
|
|
|
|
|
return LunarUtil.POSITION_CAI[this._p.ganIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getPositionCaiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionCai()];
|
|
|
|
|
},
|
|
|
|
|
getPositionTaiSui:function(){
|
|
|
|
|
return LunarUtil.POSITION_TAI_SUI_YEAR[this._p.zhiIndex];
|
|
|
|
|
},
|
|
|
|
|
getPositionTaiSuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionTaiSui()];
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYear()+'';
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return this.getYear()+'年';
|
|
|
|
|
},
|
|
|
|
|
next:function(n){
|
|
|
|
|
return LunarYear.fromYear(this._p.year + n);
|
|
|
|
|
},
|
|
|
|
|
_compute:function(){
|
|
|
|
|
this._p.months = [];
|
|
|
|
|
this._p.jieQiJulianDays = [];
|
|
|
|
|
// 节气(中午12点),长度25
|
|
|
|
|
var jq = [];
|
|
|
|
|
// 合朔,即每月初一(中午12点),长度16
|
|
|
|
|
var hs = [];
|
|
|
|
|
// 每月天数,长度15
|
|
|
|
|
var dayCounts = [];
|
|
|
|
|
var i;
|
|
|
|
|
var j;
|
|
|
|
|
var currentYear = this._p.year;
|
|
|
|
|
var year = currentYear - 2000;
|
|
|
|
|
// 从上年的大雪到下年的大寒
|
|
|
|
|
for (i = 0, j = Lunar.JIE_QI_IN_USE.length; i < j; i++) {
|
|
|
|
|
// 精确的节气
|
|
|
|
|
var t = 36525 * ShouXingUtil.saLonT((year + (17 + i) * 15.0 / 360) * ShouXingUtil.PI_2);
|
|
|
|
|
t += ShouXingUtil.ONE_THIRD - ShouXingUtil.dtT(t);
|
|
|
|
|
this._p.jieQiJulianDays.push(t + Solar.J2000);
|
|
|
|
|
// 按中午12点算的节气
|
|
|
|
|
if (i > 0 && i < 26) {
|
|
|
|
|
jq[i - 1] = Math.round(t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 冬至前的初一
|
|
|
|
|
var w = ShouXingUtil.calcShuo(jq[0]);
|
|
|
|
|
if (w > jq[0]) {
|
|
|
|
|
w -= 29.5306;
|
|
|
|
|
}
|
|
|
|
|
// 递推每月初一
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
|
hs.push(ShouXingUtil.calcShuo(w + 29.5306 * i));
|
|
|
|
|
}
|
|
|
|
|
// 每月天数
|
|
|
|
|
for (i = 0; i < 15; i++) {
|
|
|
|
|
dayCounts.push(Math.floor(hs[i + 1] - hs[i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var currentYearLeap = _LEAP['_' + currentYear];
|
|
|
|
|
if (!currentYearLeap) {
|
|
|
|
|
currentYearLeap = -1;
|
|
|
|
|
if (hs[13] <= jq[24]) {
|
|
|
|
|
i = 1;
|
|
|
|
|
while (hs[i + 1] > jq[2 * i] && i < 13) {
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
currentYearLeap = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var prevYear = currentYear - 1;
|
|
|
|
|
var prevYearLeap = _LEAP['_' + prevYear];
|
|
|
|
|
prevYearLeap = prevYearLeap ? prevYearLeap - 12 : -1;
|
|
|
|
|
|
|
|
|
|
var y = this._p.year - 1;
|
|
|
|
|
var m = 11;
|
|
|
|
|
for (i = 0, j = dayCounts.length; i < j; i++) {
|
|
|
|
|
var cm = m;
|
|
|
|
|
var isNextLeap = false;
|
|
|
|
|
if (y === currentYear && i === currentYearLeap) {
|
|
|
|
|
cm = -cm;
|
|
|
|
|
} else if (y === prevYear && i === prevYearLeap) {
|
|
|
|
|
cm = -cm;
|
|
|
|
|
}
|
|
|
|
|
if (y === currentYear && i + 1 === currentYearLeap) {
|
|
|
|
|
isNextLeap = true;
|
|
|
|
|
} else if (y === prevYear && i + 1 === prevYearLeap) {
|
|
|
|
|
isNextLeap = true;
|
|
|
|
|
}
|
|
|
|
|
this._p.months.push(LunarMonth._(y, cm, dayCounts[i], hs[i] + Solar.J2000));
|
|
|
|
|
if (!isNextLeap) {
|
|
|
|
|
m++;
|
|
|
|
|
}
|
|
|
|
|
if (m === 13) {
|
|
|
|
|
m = 1;
|
|
|
|
|
y++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
}._compute();
|
|
|
|
|
};
|
|
|
|
|
var _fromCachedYear = function(lunarYear) {
|
|
|
|
|
var key = '_' + lunarYear;
|
|
|
|
|
var obj = _CACHE[key];
|
|
|
|
|
if (!obj) {
|
|
|
|
|
obj = _fromYear(lunarYear);
|
|
|
|
|
_CACHE[key] = obj;
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYear:function(lunarYear){return _fromCachedYear(lunarYear);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var LunarMonth = (function(){
|
|
|
|
|
var _fromYm = function(lunarYear,lunarMonth){
|
|
|
|
|
return LunarYear.fromYear(lunarYear).getMonth(lunarMonth);
|
|
|
|
|
};
|
|
|
|
|
var _new = function(lunarYear, lunarMonth, dayCount, firstJulianDay){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
year: lunarYear,
|
|
|
|
|
month: lunarMonth,
|
|
|
|
|
dayCount: dayCount,
|
|
|
|
|
firstJulianDay: firstJulianDay
|
|
|
|
|
},
|
|
|
|
|
getYear:function(){return this._p.year;},
|
|
|
|
|
getMonth:function(){return this._p.month;},
|
|
|
|
|
getDayCount:function(){return this._p.dayCount;},
|
|
|
|
|
getFirstJulianDay:function(){return this._p.firstJulianDay;},
|
|
|
|
|
isLeap:function(){return this._p.month<0;},
|
|
|
|
|
getPositionTaiSui:function(){
|
|
|
|
|
var p = '';
|
|
|
|
|
var m = Math.abs(this._p.month);
|
|
|
|
|
switch(m) {
|
|
|
|
|
case 1:
|
|
|
|
|
case 5:
|
|
|
|
|
case 9:
|
|
|
|
|
p = '艮';
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
case 7:
|
|
|
|
|
case 11:
|
|
|
|
|
p = '坤';
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 8:
|
|
|
|
|
case 12:
|
|
|
|
|
p = '巽';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
p = LunarUtil.POSITION_GAN[Solar.fromJulianDay(this.getFirstJulianDay()).getLunar().getMonthGanIndex()];
|
|
|
|
|
}
|
|
|
|
|
return p;
|
|
|
|
|
},
|
|
|
|
|
getPositionTaiSuiDesc:function(){
|
|
|
|
|
return LunarUtil.POSITION_DESC[this.getPositionTaiSui()];
|
|
|
|
|
},
|
|
|
|
|
getNineStar:function(){
|
|
|
|
|
var index = LunarYear.fromYear(this._p.year).getZhiIndex() % 3;
|
|
|
|
|
var m = this._p.month;
|
|
|
|
|
if (m < 0) {
|
|
|
|
|
m = -m;
|
|
|
|
|
}
|
|
|
|
|
var monthZhiIndex = (13 + m) % 12;
|
|
|
|
|
var n = 27 - (index * 3);
|
|
|
|
|
if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
|
|
|
|
|
n -= 3;
|
|
|
|
|
}
|
|
|
|
|
var offset = (n - monthZhiIndex) % 9;
|
|
|
|
|
return NineStar.fromIndex(offset);
|
|
|
|
|
},
|
|
|
|
|
next:function(n){
|
|
|
|
|
if (0 == n) {
|
|
|
|
|
return LunarMonth.fromYm(this._p.year, this._p.month);
|
|
|
|
|
} else {
|
|
|
|
|
var rest = Math.abs(n);
|
|
|
|
|
var ny = this._p.year;
|
|
|
|
|
var iy = ny;
|
|
|
|
|
var im = this._p.month;
|
|
|
|
|
var index = 0;
|
|
|
|
|
var months = LunarYear.fromYear(ny).getMonths();
|
|
|
|
|
var i;
|
|
|
|
|
var m;
|
|
|
|
|
var size;
|
|
|
|
|
if (n > 0) {
|
|
|
|
|
while (true) {
|
|
|
|
|
size = months.length;
|
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
m = months[i];
|
|
|
|
|
if (m.getYear() === iy && m.getMonth() === im) {
|
|
|
|
|
index = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var more = size - index - 1;
|
|
|
|
|
if (rest < more) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
rest -= more;
|
|
|
|
|
var lastMonth = months[size - 1];
|
|
|
|
|
iy = lastMonth.getYear();
|
|
|
|
|
im = lastMonth.getMonth();
|
|
|
|
|
ny++;
|
|
|
|
|
months = LunarYear.fromYear(ny).getMonths();
|
|
|
|
|
}
|
|
|
|
|
return months[index + rest];
|
|
|
|
|
} else {
|
|
|
|
|
while (true) {
|
|
|
|
|
size = months.length;
|
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
m = months[i];
|
|
|
|
|
if (m.getYear() === iy && m.getMonth() === im) {
|
|
|
|
|
index = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rest <= index) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
rest -= index;
|
|
|
|
|
var firstMonth = months[0];
|
|
|
|
|
iy = firstMonth.getYear();
|
|
|
|
|
im = firstMonth.getMonth();
|
|
|
|
|
ny--;
|
|
|
|
|
months = LunarYear.fromYear(ny).getMonths();
|
|
|
|
|
}
|
|
|
|
|
return months[index - rest];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
toString:function(){return this.getYear()+'年'+(this.isLeap()?'闰':'')+LunarUtil.MONTH[Math.abs(this.getMonth())]+'月('+this.getDayCount()+')天';}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYm:function(lunarYear,lunarMonth){return _fromYm(lunarYear,lunarMonth);},
|
|
|
|
|
_:function(lunarYear, lunarMonth, dayCount, firstJulianDay){return _new(lunarYear, lunarMonth, dayCount, firstJulianDay);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var ShouXingUtil = (function(){
|
|
|
|
|
return {
|
|
|
|
|
PI_2: 2*Math.PI,
|
|
|
|
|
ONE_THIRD: 1.0/3,
|
|
|
|
|
SECOND_PER_DAY: 86400,
|
|
|
|
|
SECOND_PER_RAD: 648000 / Math.PI,
|
|
|
|
|
NUT_B:[2.1824, -33.75705, 36e-6, -1720, 920, 3.5069, 1256.66393, 11e-6, -132, 57, 1.3375, 16799.4182, -51e-6, -23, 10, 4.3649, -67.5141, 72e-6, 21, -9, 0.04, -628.302, 0, -14, 0, 2.36, 8328.691, 0, 7, 0, 3.46, 1884.966, 0, -5, 2, 5.44, 16833.175, 0, -4, 2, 3.69, 25128.110, 0, -3, 0, 3.55, 628.362, 0, 2, 0],
|
|
|
|
|
DT_AT:[-4000, 108371.7, -13036.80, 392.000, 0.0000, -500, 17201.0, -627.82, 16.170, -0.3413, -150, 12200.6, -346.41, 5.403, -0.1593, 150, 9113.8, -328.13, -1.647, 0.0377, 500, 5707.5, -391.41, 0.915, 0.3145, 900, 2203.4, -283.45, 13.034, -0.1778, 1300, 490.1, -57.35, 2.085, -0.0072, 1600, 120.0, -9.81, -1.532, 0.1403, 1700, 10.2, -0.91, 0.510, -0.0370, 1800, 13.4, -0.72, 0.202, -0.0193, 1830, 7.8, -1.81, 0.416, -0.0247, 1860, 8.3, -0.13, -0.406, 0.0292, 1880, -5.4, 0.32, -0.183, 0.0173, 1900, -2.3, 2.06, 0.169, -0.0135, 1920, 21.2, 1.69, -0.304, 0.0167, 1940, 24.2, 1.22, -0.064, 0.0031, 1960, 33.2, 0.51, 0.231, -0.0109, 1980, 51.0, 1.29, -0.026, 0.0032, 2000, 63.87, 0.1, 0, 0, 2005, 64.7, 0.4, 0, 0, 2015, 69],
|
|
|
|
|
XL0:[10000000000, 20, 578, 920, 1100, 1124, 1136, 1148, 1217, 1226, 1229, 1229, 1229, 1229, 1937, 2363, 2618, 2633, 2660, 2666, 17534704567, 0.00000000000, 0.00000000000, 334165646, 4.669256804, 6283.075849991, 3489428, 4.6261024, 12566.1517000, 349706, 2.744118, 5753.384885, 341757, 2.828866, 3.523118, 313590, 3.627670, 77713.771468, 267622, 4.418084, 7860.419392, 234269, 6.135162, 3930.209696, 132429, 0.742464, 11506.769770, 127317, 2.037097, 529.690965, 119917, 1.109629, 1577.343542, 99025, 5.23268, 5884.92685, 90186, 2.04505, 26.29832, 85722, 3.50849, 398.14900, 77979, 1.17883, 5223.69392, 75314, 2.53339, 5507.55324, 50526, 4.58293, 18849.22755, 49238, 4.20507, 775.52261, 35666, 2.91954, 0.06731, 31709, 5.84902, 11790.62909, 28413, 1.89869, 796.29801, 27104, 0.31489, 10977.07880, 24281, 0.34481, 5486.77784, 20616, 4.80647, 2544.31442, 20539, 1.86948, 5573.14280, 20226, 2.45768, 6069.77675, 15552, 0.83306, 213.29910, 13221, 3.41118, 2942.46342, 12618, 1.08303, 20.77540, 11513, 0.64545, 0.98032, 10285, 0.63600, 4694.00295, 10190, 0.97569, 15720.83878, 10172, 4.26680, 7.11355, 9921, 6.2099, 2146.1654, 9761, 0.6810, 155.4204, 8580, 5.9832, 161000.6857, 8513, 1.2987, 6275.9623, 8471, 3.6708, 71430.6956, 7964, 1.8079, 17260.1547, 7876, 3.0370, 12036.4607, 7465, 1.7551, 5088.6288, 7387, 3.5032, 3154.6871, 7355, 4.6793, 801.8209, 6963, 0.8330, 9437.7629, 6245, 3.9776, 8827.3903, 6115, 1.8184, 7084.8968, 5696, 2.7843, 6286.5990, 5612, 4.3869, 14143.4952, 5558, 3.4701, 6279.5527, 5199, 0.1891, 12139.5535, 5161, 1.3328, 1748.0164, 5115, 0.2831, 5856.4777, 4900, 0.4874, 1194.4470, 4104, 5.3682, 8429.2413, 4094, 2.3985, 19651.0485, 3920, 6.1683, 10447.3878, 3677, 6.0413, 10213.2855, 3660, 2.5696, 1059.3819, 3595, 1.7088, 2352.8662, 3557, 1.7760, 6812.7668, 3329, 0.5931, 17789.8456, 3041, 0.4429, 83996.8473, 3005, 2.7398, 1349.8674, 2535, 3.1647, 4690.4798, 2474, 0.2148, 3.5904, 2366, 0.4847, 8031.0923, 2357, 2.0653, 3340.6124, 2282, 5.2220, 4705.7323, 2189, 5.5559, 553.5694, 2142, 1.4256, 16730.4637, 2109, 4.1483, 951.7184, 2030, 0.3713, 283.8593, 1992, 5.2221, 12168.0027, 1986, 5.7747, 6309.3742, 1912, 3.8222, 23581.2582, 1889, 5.3863, 149854.4001, 1790, 2.2149, 13367.9726, 1748, 4.5605, 135.0651, 1622, 5.9884, 11769.8537, 1508, 4.1957, 6256.7775, 1442, 4.1932, 242.7286, 1435, 3.7236, 38.0277, 1397, 4.4014, 6681.2249, 1362, 1.8893, 7632.9433, 1250, 1.1305, 5.5229, 1205, 2.6223, 955.5997, 1200, 1.0035, 632.7837, 1129, 0.1774, 4164.3120, 1083, 0.3273, 103.0928, 1052, 0.9387, 11926.2544, 1050, 5.3591, 1592.5960, 1033, 6.1998, 6438.4962, 1001, 6.0291, 5746.2713, 980, 0.999, 11371.705, 980, 5.244, 27511.468, 938, 2.624, 5760.498, 923, 0.483, 522.577, 922, 4.571, 4292.331, 905, 5.337, 6386.169, 862, 4.165, 7058.598, 841, 3.299, 7234.794, 836, 4.539, 25132.303, 813, 6.112, 4732.031, 812, 6.271, 426.598, 801, 5.821, 28.449, 787, 0.996, 5643.179, 776, 2.957, 23013.540, 769, 3.121, 7238.676, 758, 3.974, 11499.656, 735, 4.386, 316.392, 731, 0.607, 11513.883, 719, 3.998, 74.782, 706, 0.323, 263.084, 676, 5.911, 90955.552, 663, 3.665, 17298.182, 653, 5.791, 18073.705, 630, 4.717, 6836.645, 615, 1.458, 233141.314, 612, 1.075, 19804.827, 596, 3.321, 6283.009, 596, 2.876, 6283.143, 555, 2.452, 12352.853, 541, 5.392, 419.485, 531, 0.382, 31441.678, 519, 4.065, 6208.294, 513, 2.361, 10973.556, 494, 5.737, 9917.697, 450, 3.272, 11015.106, 449, 3.653, 206.186, 447, 2.064, 7079.374, 435, 4.423, 5216.580, 421, 1.906, 245.832, 413, 0.921, 3738.761, 402, 0.840, 20.355, 387, 1.826, 11856.219, 379, 2.344, 3.881, 374, 2.954, 3128.389, 370, 5.031, 536.805, 365, 1.018, 16200.773, 365, 1.083, 88860.057, 352, 5.978, 3894.182, 352, 2.056, 244287.600, 351, 3.713, 6290.189, 340, 1.106, 14712.317, 339, 0.978, 8635.942, 339, 3.202, 5120.601, 333, 0.837, 6496.375, 325, 3.479, 6133.513, 316, 5.089, 21228.392, 316, 1.328, 10873.986, 309, 3.646, 10.637, 303, 1.802, 35371.887, 296, 3.397, 9225.539, 288, 6.026, 154717.610, 281, 2.585, 14314.168, 262, 3.856, 266.607, 262, 2.579, 22483.849, 257, 1.561, 23543.231, 255, 3.949, 1990.745, 251, 3.744, 10575.407, 240, 1.
|
|
|
|
|
XL1:[
|
|
|
|
|
[22639.586, 0.78475822, 8328.691424623, 1.5229241, 25.0719, -0.123598, 4586.438, 0.1873974, 7214.06286536, -2.184756, -18.860, 0.08280, 2369.914, 2.5429520, 15542.75428998, -0.661832, 6.212, -0.04080, 769.026, 3.140313, 16657.38284925, 3.04585, 50.144, -0.2472, 666.418, 1.527671, 628.30195521, -0.02664, 0.062, -0.0054, 411.596, 4.826607, 16866.9323150, -1.28012, -1.07, -0.0059, 211.656, 4.115028, -1114.6285593, -3.70768, -43.93, 0.2064, 205.436, 0.230523, 6585.7609101, -2.15812, -18.92, 0.0882, 191.956, 4.898507, 23871.4457146, 0.86109, 31.28, -0.164, 164.729, 2.586078, 14914.4523348, -0.6352, 6.15, -0.035, 147.321, 5.45530, -7700.3894694, -1.5496, -25.01, 0.118, 124.988, 0.48608, 7771.3771450, -0.3309, 3.11, -0.020, 109.380, 3.88323, 8956.9933798, 1.4963, 25.13, -0.129, 55.177, 5.57033, -1324.1780250, 0.6183, 7.3, -0.035, 45.100, 0.89898, 25195.623740, 0.2428, 24.0, -0.129, 39.533, 3.81213, -8538.240890, 2.8030, 26.1, -0.118, 38.430, 4.30115, 22756.817155, -2.8466, -12.6, 0.042, 36.124, 5.49587, 24986.074274, 4.5688, 75.2, -0.371, 30.773, 1.94559, 14428.125731, -4.3695, -37.7, 0.166, 28.397, 3.28586, 7842.364821, -2.2114, -18.8, 0.077, 24.358, 5.64142, 16171.056245, -0.6885, 6.3, -0.046, 18.585, 4.41371, -557.314280, -1.8538, -22.0, 0.10, 17.954, 3.58454, 8399.679100, -0.3576, 3.2, -0.03, 14.530, 4.9416, 23243.143759, 0.888, 31.2, -0.16, 14.380, 0.9709, 32200.137139, 2.384, 56.4, -0.29, 14.251, 5.7641, -2.301200, 1.523, 25.1, -0.12, 13.899, 0.3735, 31085.508580, -1.324, 12.4, -0.08, 13.194, 1.7595, -9443.319984, -5.231, -69.0, 0.33, 9.679, 3.0997, -16029.080894, -3.072, -50.1, 0.24, 9.366, 0.3016, 24080.995180, -3.465, -19.9, 0.08, 8.606, 4.1582, -1742.930514, -3.681, -44.0, 0.21, 8.453, 2.8416, 16100.068570, 1.192, 28.2, -0.14, 8.050, 2.6292, 14286.150380, -0.609, 6.1, -0.03, 7.630, 6.2388, 17285.684804, 3.019, 50.2, -0.25, 7.447, 1.4845, 1256.603910, -0.053, 0.1, -0.01, 7.371, 0.2736, 5957.458955, -2.131, -19.0, 0.09, 7.063, 5.6715, 33.757047, -0.308, -3.6, 0.02, 6.383, 4.7843, 7004.513400, 2.141, 32.4, -0.16, 5.742, 2.6572, 32409.686605, -1.942, 5, -0.05, 4.374, 4.3443, 22128.51520, -2.820, -13, 0.05, 3.998, 3.2545, 33524.31516, 1.766, 49, -0.25, 3.210, 2.2443, 14985.44001, -2.516, -16, 0.06, 2.915, 1.7138, 24499.74767, 0.834, 31, -0.17, 2.732, 1.9887, 13799.82378, -4.343, -38, 0.17, 2.568, 5.4122, -7072.08751, -1.576, -25, 0.11, 2.521, 3.2427, 8470.66678, -2.238, -19, 0.07, 2.489, 4.0719, -486.32660, -3.734, -44, 0.20, 2.146, 5.6135, -1952.47998, 0.645, 7, -0.03, 1.978, 2.7291, 39414.20000, 0.199, 37, -0.21, 1.934, 1.5682, 33314.76570, 6.092, 100, -0.5, 1.871, 0.4166, 30457.20662, -1.297, 12, -0.1, 1.753, 2.0582, -8886.00570, -3.38, -47, 0.2, 1.437, 2.386, -695.87607, 0.59, 7, 0, 1.373, 3.026, -209.54947, 4.33, 51, -0.2, 1.262, 5.940, 16728.37052, 1.17, 28, -0.1, 1.224, 6.172, 6656.74859, -4.04, -41, 0.2, 1.187, 5.873, 6099.43431, -5.89, -63, 0.3, 1.177, 1.014, 31571.83518, 2.41, 56, -0.3, 1.162, 3.840, 9585.29534, 1.47, 25, -0.1, 1.143, 5.639, 8364.73984, -2.18, -19, 0.1, 1.078, 1.229, 70.98768, -1.88, -22, 0.1, 1.059, 3.326, 40528.82856, 3.91, 81, -0.4, 0.990, 5.013, 40738.37803, -0.42, 30, -0.2, 0.948, 5.687, -17772.01141, -6.75, -94, 0.5, 0.876, 0.298, -0.35232, 0, 0, 0, 0.822, 2.994, 393.02097, 0, 0, 0, 0.788, 1.836, 8326.39022, 3.05, 50, -0.2, 0.752, 4.985, 22614.84180, 0.91, 31, -0.2, 0.740, 2.875, 8330.99262, 0, 0, 0, 0.669, 0.744, -24357.77232, -4.60, -75, 0.4, 0.644, 1.314, 8393.12577, -2.18, -19, 0.1, 0.639, 5.888, 575.33849, 0, 0, 0, 0.635, 1.116, 23385.11911, -2.87, -13, 0, 0.584, 5.197, 24428.75999, 2.71, 53, -0.3, 0.583, 3.513, -9095.55517, 0.95, 4, 0, 0.572, 6.059, 29970.88002, -5.03, -32, 0.1, 0.565, 2.960, 0.32863, 1.52, 25, -0.1, 0.561, 4.001, -17981.56087, -2.43, -43, 0.2, 0.557, 0.529, 7143.07519, -0.30, 3, 0, 0.546, 2.311, 25614.37623, 4.54, 75, -0.4, 0.536, 4.229, 15752.30376, -4.99, -45, 0.2, 0.493, 3.316, -8294.9344, -1.83, -29, 0.1, 0.491, 1.744, 8362.4485, 1.21, 21, -0.1, 0.478, 1.803, -10071.6219, -5.20, -69, 0.3, 0.454, 0.857, 15333.2048, 3.66, 57, -0.3, 0.445, 2.071, 8311.7707,
|
|
|
|
|
[1.67680, 4.66926, 628.301955, -0.0266, 0.1, -0.005, 0.51642, 3.3721, 6585.760910, -2.158, -18.9, 0.09, 0.41383, 5.7277, 14914.452335, -0.635, 6.2, -0.04, 0.37115, 3.9695, 7700.389469, 1.550, 25.0, -0.12, 0.27560, 0.7416, 8956.993380, 1.496, 25.1, -0.13, 0.24599, 4.2253, -2.301200, 1.523, 25.1, -0.12, 0.07118, 0.1443, 7842.36482, -2.211, -19, 0.08, 0.06128, 2.4998, 16171.05625, -0.688, 6, 0, 0.04516, 0.443, 8399.67910, -0.36, 3, 0, 0.04048, 5.771, 14286.15038, -0.61, 6, 0, 0.03747, 4.626, 1256.60391, -0.05, 0, 0, 0.03707, 3.415, 5957.45895, -2.13, -19, 0.1, 0.03649, 1.800, 23243.14376, 0.89, 31, -0.2, 0.02438, 0.042, 16029.08089, 3.07, 50, -0.2, 0.02165, 1.017, -1742.93051, -3.68, -44, 0.2, 0.01923, 3.097, 17285.68480, 3.02, 50, -0.3, 0.01692, 1.280, 0.3286, 1.52, 25, -0.1, 0.01361, 0.298, 8326.3902, 3.05, 50, -0.2, 0.01293, 4.013, 7072.0875, 1.58, 25, -0.1, 0.01276, 4.413, 8330.9926, 0, 0, 0, 0.01270, 0.101, 8470.6668, -2.24, -19, 0.1, 0.01097, 1.203, 22128.5152, -2.82, -13, 0, 0.01088, 2.545, 15542.7543, -0.66, 6, 0, 0.00835, 0.190, 7214.0629, -2.18, -19, 0.1, 0.00734, 4.855, 24499.7477, 0.83, 31, -0.2, 0.00686, 5.130, 13799.8238, -4.34, -38, 0.2, 0.00631, 0.930, -486.3266, -3.73, -44, 0, 0.00585, 0.699, 9585.2953, 1.5, 25, 0, 0.00566, 4.073, 8328.3391, 1.5, 25, 0, 0.00566, 0.638, 8329.0437, 1.5, 25, 0, 0.00539, 2.472, -1952.4800, 0.6, 7, 0, 0.00509, 2.88, -0.7113, 0, 0, 0, 0.00469, 3.56, 30457.2066, -1.3, 12, 0, 0.00387, 0.78, -0.3523, 0, 0, 0, 0.00378, 1.84, 22614.8418, 0.9, 31, 0, 0.00362, 5.53, -695.8761, 0.6, 7, 0, 0.00317, 2.80, 16728.3705, 1.2, 28, 0, 0.00303, 6.07, 157.7344, 0, 0, 0, 0.00300, 2.53, 33.7570, -0.3, -4, 0, 0.00295, 4.16, 31571.8352, 2.4, 56, 0, 0.00289, 5.98, 7211.7617, -0.7, 6, 0, 0.00285, 2.06, 15540.4531, 0.9, 31, 0, 0.00283, 2.65, 2.6298, 0, 0, 0, 0.00282, 6.17, 15545.0555, -2.2, -19, 0, 0.00278, 1.23, -39.8149, 0, 0, 0, 0.00272, 3.82, 7216.3641, -3.7, -44, 0, 0.00270, 4.37, 70.9877, -1.9, -22, 0, 0.00256, 5.81, 13657.8484, -0.6, 6, 0, 0.00244, 5.64, -0.2237, 1.5, 25, 0, 0.00240, 2.96, 8311.7707, -2.2, -19, 0, 0.00239, 0.87, -33.7814, 0.3, 4, 0, 0.00216, 2.31, 15.9995, -2.2, -19, 0, 0.00186, 3.46, 5329.1570, -2.1, -19, 0, 0.00169, 2.40, 24357.772, 4.6, 75, 0, 0.00161, 5.80, 8329.403, 1.5, 25, 0, 0.00161, 5.20, 8327.980, 1.5, 25, 0, 0.00160, 4.26, 23385.119, -2.9, -13, 0, 0.00156, 1.26, 550.755, 0, 0, 0, 0.00155, 1.25, 21500.213, -2.8, -13, 0, 0.00152, 0.60, -16.921, -3.7, -44, 0, 0.00150, 2.71, -79.630, 0, 0, 0, 0.00150, 5.29, 15.542, 0, 0, 0, 0.00148, 1.06, -2371.232, -3.7, -44, 0, 0.00141, 0.77, 8328.691, 1.5, 25, 0, 0.00141, 3.67, 7143.075, -0.3, 0, 0, 0.00138, 5.45, 25614.376, 4.5, 75, 0, 0.00129, 4.90, 23871.446, 0.9, 31, 0, 0.00126, 4.03, 141.975, -3.8, -44, 0, 0.00124, 6.01, 522.369, 0, 0, 0, 0.00120, 4.94, -10071.622, -5.2, -69, 0, 0.00118, 5.07, -15.419, -2.2, -19, 0, 0.00107, 3.49, 23452.693, -3.4, -20, 0, 0.00104, 4.78, 17495.234, -1.3, 0, 0, 0.00103, 1.44, -18.049, -2.2, -19, 0, 0.00102, 5.63, 15542.402, -0.7, 6, 0, 0.00102, 2.59, 15543.107, -0.7, 6, 0, 0.00100, 4.11, -6.559, -1.9, -22, 0, 0.00097, 0.08, 15400.779, 3.1, 50, 0, 0.00096, 5.84, 31781.385, -1.9, 5, 0, 0.00094, 1.08, 8328.363, 0, 0, 0, 0.00094, 2.46, 16799.358, -0.7, 6, 0, 0.00094, 1.69, 6376.211, 2.2, 32, 0, 0.00093, 3.64, 8329.020, 3.0, 50, 0, 0.00093, 2.65, 16655.082, 4.6, 75, 0, 0.00090, 1.90, 15056.428, -4.4, -38, 0, 0.00089, 1.59, 52.969, 0, 0, 0, 0.00088, 2.02, -8257.704, -3.4, -47, 0, 0.00088, 3.02, 7213.711, -2.2, -19, 0, 0.00087, 0.50, 7214.415, -2.2, -19, 0, 0.00087, 0.49, 16659.684, 1.5, 25, 0, 0.00082, 5.64, -4.931, 1.5, 25, 0, 0.00079, 5.17, 13171.522, -4.3, -38, 0, 0.00076, 3.60, 29828.905, -1.3, 12, 0, 0.00076, 4.08, 24567.322, 0.3, 24, 0, 0.00076, 4.58, 1884.906, -0.1, 0, 0, 0.00073, 0.33, 31713.811, -1.4, 12, 0, 0.00073, 0.93, 32828.439, 2.4, 56, 0, 0.00071, 5.91, 38785.898, 0.2, 37, 0, 0.00069, 2.20, 15613.742, -2.5, -16, 0, 0.00066, 3.87, 15.732, -2.5, -23, 0, 0.00066, 0.86, 25823.926, 0.2, 24, 0, 0.00065, 2.52, 8170.957, 1.5, 25, 0, 0.00063, 0.18, 8322.132, -0.3, 0, 0, 0.00060, 5.84, 8326.0
|
|
|
|
|
[0.004870, 4.6693, 628.30196, -0.027, 0, -0.01, 0.002280, 2.6746, -2.30120, 1.523, 25, -0.12, 0.001500, 3.372, 6585.76091, -2.16, -19, 0.1, 0.001200, 5.728, 14914.45233, -0.64, 6, 0, 0.001080, 3.969, 7700.38947, 1.55, 25, -0.1, 0.000800, 0.742, 8956.99338, 1.50, 25, -0.1, 0.000254, 6.002, 0.3286, 1.52, 25, -0.1, 0.000210, 0.144, 7842.3648, -2.21, -19, 0, 0.000180, 2.500, 16171.0562, -0.7, 6, 0, 0.000130, 0.44, 8399.6791, -0.4, 3, 0, 0.000126, 5.03, 8326.3902, 3.0, 50, 0, 0.000120, 5.77, 14286.1504, -0.6, 6, 0, 0.000118, 5.96, 8330.9926, 0, 0, 0, 0.000110, 1.80, 23243.1438, 0.9, 31, 0, 0.000110, 3.42, 5957.4590, -2.1, -19, 0, 0.000110, 4.63, 1256.6039, -0.1, 0, 0, 0.000099, 4.70, -0.7113, 0, 0, 0, 0.000070, 0.04, 16029.0809, 3.1, 50, 0, 0.000070, 5.14, 8328.3391, 1.5, 25, 0, 0.000070, 5.85, 8329.0437, 1.5, 25, 0, 0.000060, 1.02, -1742.9305, -3.7, -44, 0, 0.000060, 3.10, 17285.6848, 3.0, 50, 0, 0.000054, 5.69, -0.352, 0, 0, 0, 0.000043, 0.52, 15.542, 0, 0, 0, 0.000041, 2.03, 2.630, 0, 0, 0, 0.000040, 0.10, 8470.667, -2.2, -19, 0, 0.000040, 4.01, 7072.088, 1.6, 25, 0, 0.000036, 2.93, -8.860, -0.3, 0, 0, 0.000030, 1.20, 22128.515, -2.8, -13, 0, 0.000030, 2.54, 15542.754, -0.7, 6, 0, 0.000027, 4.43, 7211.762, -0.7, 6, 0, 0.000026, 0.51, 15540.453, 0.9, 31, 0, 0.000026, 1.44, 15545.055, -2.2, -19, 0, 0.000025, 5.37, 7216.364, -3.7, -44, 0],
|
|
|
|
|
[0.00001200, 1.041, -2.3012, 1.52, 25, -0.1, 0.00000170, 0.31, -0.711, 0, 0, 0]
|
|
|
|
|
],
|
|
|
|
|
SHUO_KB:[1457698.231017, 29.53067166, 1546082.512234, 29.53085106, 1640640.735300, 29.53060000, 1642472.151543, 29.53085439, 1683430.509300, 29.53086148, 1752148.041079, 29.53085097, 1807665.420323, 29.53059851, 1883618.114100, 29.53060000, 1907360.704700, 29.53060000, 1936596.224900, 29.53060000, 1939135.675300, 29.53060000, 1947168.00],
|
|
|
|
|
SB:'00000000000000000000000020000002000000000000200000001000000000000000000000000000000000000010002000000000000000200000000200000000000000000000002000000000020000000000000000000000000000000000100000000000010000001000001000000000000000100000000020000000000000002000000000000001000000000000001000000000000100000000010010000020000202001101002020200101000002020010100002000000010100202000001010000202020001010000202020001010000202000001010020202001010000020200101000022000010101002020001010100002020201010100002020200010100002020000010100202000010100000202001010000220200101010020200010101001000000000001001000200000000000020000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000020010000000000000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000010001000000100001001010010101000000000000100001000001000100000000001000000000000100100000000010010100010000000000000000000100011000000000000000000002000000001020000000001001000001000001001000000001000100010010000100001000000100000100100010000000000000010000200000000000000000000000000000000001000000000100100000000000000000000000000000000000000000000000000010000000000101000000000000000000000000000001001010010010100100010000010010000001001001001001000000100100000100010000000100000000000000100000000010100000000001000100010100100000010000000010010000000001000001000000101002000000000100000000000000100001000000010100000101001000000100100100100100000010010010000001001010000000100101001000000000101001000000010101000000000010000001000001000001000000100000000000010010000000000000000010000000100010010000000100000010000010100010010000000000000000001001000000000100101000000010000100110100000000100000000000010000000010000010000100010000000000000000000000010000000000000000100000001000000000001000000000000000100000000000100000010000000100001010000000000101000010100000001001000000010100000000000000000000001000000000001000000000000000000000000000000000000000100000001000000000000100000000000000000000000010000000010010000000001000001010100000001000000000000001000010000101001001010000001000101000000000100100000100110000010010010010001001010010010000001000000000000101000010000000101000000000010000001001001001001000000100101000000010000100010101001010010010000101010010000000101010010000000100010010000010010010000001001010000000100101000100010000000100100001000100100000101010000000000101010100100000100000000000010010000010001001010001000100000001001010000000000000001000100100000100010100001010100000100000000100100100100010010100010001000000010010100000010001010000000001000000000001001010100000001000010100000001001010000101000000010010000100101001000100010100000000010000010000010010001000001000010100000001000000100001000000010000101001001010000001000101000001000100100000100100000010010010010101000000010000000000000010000000001010010010000100010000010010000001001000001001000000100100000100010010100100100001010000100000001010000100000001010100000000100000010000010010010000001001010001000100101000101000010100100000001010100100000001010100000000001000000100000000100100000010010100000000000010001000100000001001000010001001000001010101001000001000101001000100000001000000100100000100010000100010001000000010010100000010000000010001000010001000001000010101000000000010100001000001000100101000100010000000100101000000100010000000000010000010000010010101000000010000101000000010010100001010000010100000001001010000001000101000000000100000000100100101000000000000101000000000100001000010000000100001010010010100000010001010000010001000000001001000000000100000101000010100100000000010100100000001010100100100001000100002000000100002200001010010000000001010001010000101001001000010100001000000010101001000001010001000000000000000100000000100100000001000100010000000010000
|
|
|
|
|
nutationLon2:function(t){
|
|
|
|
|
var a = -1.742 * t;
|
|
|
|
|
var t2 = t * t;
|
|
|
|
|
var dl = 0;
|
|
|
|
|
for (var i = 0, j = this.NUT_B.length; i < j; i += 5) {
|
|
|
|
|
dl += (this.NUT_B[i + 3] + a) * Math.sin(this.NUT_B[i] + this.NUT_B[i + 1] * t + this.NUT_B[i + 2] * t2);
|
|
|
|
|
a = 0;
|
|
|
|
|
}
|
|
|
|
|
return dl / 100 / this.SECOND_PER_RAD;
|
|
|
|
|
},
|
|
|
|
|
eLon:function(t,n){
|
|
|
|
|
t /= 10;
|
|
|
|
|
var v = 0;
|
|
|
|
|
var tn = 1;
|
|
|
|
|
var n1;
|
|
|
|
|
var n2;
|
|
|
|
|
var m;
|
|
|
|
|
var c;
|
|
|
|
|
var pn = 1;
|
|
|
|
|
var n0;
|
|
|
|
|
var m0 = this.XL0[pn + 1] - this.XL0[pn];
|
|
|
|
|
for (var i = 0; i < 6; i++, tn *= t) {
|
|
|
|
|
n1 = Math.floor(this.XL0[pn + i]);
|
|
|
|
|
n2 = Math.floor(this.XL0[pn + 1 + i]);
|
|
|
|
|
n0 = n2 - n1;
|
|
|
|
|
if (n0 === 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (n < 0) {
|
|
|
|
|
m = n2;
|
|
|
|
|
} else {
|
|
|
|
|
m = Math.floor((3 * n * n0 / m0 + 0.5) + n1);
|
|
|
|
|
if (i != 0) {
|
|
|
|
|
m += 3;
|
|
|
|
|
}
|
|
|
|
|
if (m > n2) {
|
|
|
|
|
m = n2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
c = 0;
|
|
|
|
|
for (var j = n1; j < m; j += 3) {
|
|
|
|
|
c += this.XL0[j] * Math.cos(this.XL0[j + 1] + t * this.XL0[j + 2]);
|
|
|
|
|
}
|
|
|
|
|
v += c * tn;
|
|
|
|
|
}
|
|
|
|
|
v /= this.XL0[0];
|
|
|
|
|
var t2 = t * t;
|
|
|
|
|
v += (-0.0728 - 2.7702 * t - 1.1019 * t2 - 0.0996 * t2 * t) / this.SECOND_PER_RAD;
|
|
|
|
|
return v;
|
|
|
|
|
},
|
|
|
|
|
mLon:function(t,n){
|
|
|
|
|
var ob = this.XL1;
|
|
|
|
|
var obl = ob[0].length;
|
|
|
|
|
var tn = 1;
|
|
|
|
|
var v = 0;
|
|
|
|
|
var j;
|
|
|
|
|
var c;
|
|
|
|
|
var t2 = t * t;
|
|
|
|
|
var t3 = t2 * t;
|
|
|
|
|
var t4 = t3 * t;
|
|
|
|
|
var t5 = t4 * t;
|
|
|
|
|
var tx = t - 10;
|
|
|
|
|
v += (3.81034409 + 8399.684730072 * t - 3.319e-05 * t2 + 3.11e-08 * t3 - 2.033e-10 * t4) * this.SECOND_PER_RAD;
|
|
|
|
|
v += 5028.792262 * t + 1.1124406 * t2 + 0.00007699 * t3 - 0.000023479 * t4 - 0.0000000178 * t5;
|
|
|
|
|
if (tx > 0) {
|
|
|
|
|
v += -0.866 + 1.43 * tx + 0.054 * tx * tx;
|
|
|
|
|
}
|
|
|
|
|
t2 /= 1e4;
|
|
|
|
|
t3 /= 1e8;
|
|
|
|
|
t4 /= 1e8;
|
|
|
|
|
|
|
|
|
|
n *= 6;
|
|
|
|
|
if (n < 0) {
|
|
|
|
|
n = obl;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0, x = ob.length; i < x; i++, tn *= t) {
|
|
|
|
|
var f = ob[i];
|
|
|
|
|
var l = f.length;
|
|
|
|
|
var m = Math.floor((n * l / obl + 0.5));
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
m += 6;
|
|
|
|
|
}
|
|
|
|
|
if (m >= l) {
|
|
|
|
|
m = l;
|
|
|
|
|
}
|
|
|
|
|
for (j = 0, c = 0; j < m; j += 6) {
|
|
|
|
|
c += f[j] * Math.cos(f[j + 1] + t * f[j + 2] + t2 * f[j + 3] + t3 * f[j + 4] + t4 * f[j + 5]);
|
|
|
|
|
}
|
|
|
|
|
v += c * tn;
|
|
|
|
|
}
|
|
|
|
|
v /= this.SECOND_PER_RAD;
|
|
|
|
|
return v;
|
|
|
|
|
},
|
|
|
|
|
gxcSunLon:function(t){
|
|
|
|
|
var t2 = t * t;
|
|
|
|
|
var v = -0.043126 + 628.301955 * t - 0.000002732 * t2;
|
|
|
|
|
var e = 0.016708634 - 0.000042037 * t - 0.0000001267 * t2;
|
|
|
|
|
return -20.49552 * (1 + e * Math.cos(v)) / this.SECOND_PER_RAD;
|
|
|
|
|
},
|
|
|
|
|
ev:function(t){
|
|
|
|
|
var f = 628.307585 * t;
|
|
|
|
|
return 628.332 + 21 * Math.sin(1.527 + f) + 0.44 * Math.sin(1.48 + f * 2) + 0.129 * Math.sin(5.82 + f) * t + 0.00055 * Math.sin(4.21 + f) * t * t;
|
|
|
|
|
},
|
|
|
|
|
saLon:function(t,n){
|
|
|
|
|
return this.eLon(t, n) + this.nutationLon2(t) + this.gxcSunLon(t) + Math.PI;
|
|
|
|
|
},
|
|
|
|
|
dtExt:function(y,jsd){
|
|
|
|
|
var dy = (y - 1820) / 100;
|
|
|
|
|
return -20 + jsd * dy * dy;
|
|
|
|
|
},
|
|
|
|
|
dtCalc:function(y){
|
|
|
|
|
var size = this.DT_AT.length;
|
|
|
|
|
var y0 = this.DT_AT[size - 2];
|
|
|
|
|
var t0 = this.DT_AT[size - 1];
|
|
|
|
|
if (y >= y0) {
|
|
|
|
|
var jsd = 31;
|
|
|
|
|
if (y > y0 + 100) {
|
|
|
|
|
return this.dtExt(y, jsd);
|
|
|
|
|
}
|
|
|
|
|
return this.dtExt(y, jsd) - (this.dtExt(y0, jsd) - t0) * (y0 + 100 - y) / 100;
|
|
|
|
|
}
|
|
|
|
|
var i;
|
|
|
|
|
for (i = 0; i < size; i += 5) {
|
|
|
|
|
if (y < this.DT_AT[i + 5]) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var t1 = (y - this.DT_AT[i]) / (this.DT_AT[i + 5] - this.DT_AT[i]) * 10;
|
|
|
|
|
var t2 = t1 * t1;
|
|
|
|
|
var t3 = t2 * t1;
|
|
|
|
|
return this.DT_AT[i + 1] + this.DT_AT[i + 2] * t1 + this.DT_AT[i + 3] * t2 + this.DT_AT[i + 4] * t3;
|
|
|
|
|
},
|
|
|
|
|
dtT:function(t){
|
|
|
|
|
return this.dtCalc(t / 365.2425 + 2000) / this.SECOND_PER_DAY;
|
|
|
|
|
},
|
|
|
|
|
mv:function(t){
|
|
|
|
|
var v = 8399.71 - 914 * Math.sin(0.7848 + 8328.691425 * t + 0.0001523 * t * t);
|
|
|
|
|
v -= 179 * Math.sin(2.543 + 15542.7543 * t) + 160 * Math.sin(0.1874 + 7214.0629 * t) + 62 * Math.sin(3.14 + 16657.3828 * t) + 34 * Math.sin(4.827 + 16866.9323 * t) + 22 * Math.sin(4.9 + 23871.4457 * t) + 12 * Math.sin(2.59 + 14914.4523 * t) + 7 * Math.sin(0.23 + 6585.7609 * t) + 5 * Math.sin(0.9 + 25195.624 * t) + 5 * Math.sin(2.32 - 7700.3895 * t) + 5 * Math.sin(3.88 + 8956.9934 * t) + 5 * Math.sin(0.49 + 7771.3771 * t);
|
|
|
|
|
return v;
|
|
|
|
|
},
|
|
|
|
|
saLonT:function(w){
|
|
|
|
|
var t;
|
|
|
|
|
var v = 628.3319653318;
|
|
|
|
|
t = (w - 1.75347 - Math.PI) / v;
|
|
|
|
|
v = this.ev(t);
|
|
|
|
|
t += (w - this.saLon(t, 10)) / v;
|
|
|
|
|
v = this.ev(t);
|
|
|
|
|
t += (w - this.saLon(t, -1)) / v;
|
|
|
|
|
return t;
|
|
|
|
|
},
|
|
|
|
|
msaLon:function(t,mn,sn){
|
|
|
|
|
return this.mLon(t, mn) + (-3.4E-6) - (this.eLon(t, sn) + this.gxcSunLon(t) + Math.PI);
|
|
|
|
|
},
|
|
|
|
|
msaLonT:function(w){
|
|
|
|
|
var t;
|
|
|
|
|
var v = 7771.37714500204;
|
|
|
|
|
t = (w + 1.08472) / v;
|
|
|
|
|
t += (w - this.msaLon(t, 3, 3)) / v;
|
|
|
|
|
v = this.mv(t) - this.ev(t);
|
|
|
|
|
t += (w - this.msaLon(t, 20, 10)) / v;
|
|
|
|
|
t += (w - this.msaLon(t, -1, 60)) / v;
|
|
|
|
|
return t;
|
|
|
|
|
},
|
|
|
|
|
msaLonT2:function(w){
|
|
|
|
|
var t;
|
|
|
|
|
var l;
|
|
|
|
|
var v = 7771.37714500204;
|
|
|
|
|
t = (w + 1.08472) / v;
|
|
|
|
|
var t2 = t * t;
|
|
|
|
|
t -= (-0.00003309 * t2 + 0.10976 * Math.cos(0.784758 + 8328.6914246 * t + 0.000152292 * t2) + 0.02224 * Math.cos(0.18740 + 7214.0628654 * t - 0.00021848 * t2) - 0.03342 * Math.cos(4.669257 + 628.307585 * t)) / v;
|
|
|
|
|
t2 = t * t;
|
|
|
|
|
l = this.mLon(t, 20) - (4.8950632 + 628.3319653318 * t + 0.000005297 * t2 + 0.0334166 * Math.cos(4.669257 + 628.307585 * t) + 0.0002061 * Math.cos(2.67823 + 628.307585 * t) * t + 0.000349 * Math.cos(4.6261 + 1256.61517 * t) - 20.5 / this.SECOND_PER_RAD);
|
|
|
|
|
v = 7771.38 - 914 * Math.sin(0.7848 + 8328.691425 * t + 0.0001523 * t2) - 179 * Math.sin(2.543 + 15542.7543 * t) - 160 * Math.sin(0.1874 + 7214.0629 * t);
|
|
|
|
|
t += (w - l) / v;
|
|
|
|
|
return t;
|
|
|
|
|
},
|
|
|
|
|
shuoHigh:function(w){
|
|
|
|
|
var t = this.msaLonT2(w) * 36525;
|
|
|
|
|
t = t - this.dtT(t) + this.ONE_THIRD;
|
|
|
|
|
var v = ((t + 0.5) % 1) * this.SECOND_PER_DAY;
|
|
|
|
|
if (v < 1800 || v > this.SECOND_PER_DAY - 1800) {
|
|
|
|
|
t = this.msaLonT(w) * 36525 - this.dtT(t) + this.ONE_THIRD;
|
|
|
|
|
}
|
|
|
|
|
return t;
|
|
|
|
|
},
|
|
|
|
|
shuoLow:function(w){
|
|
|
|
|
var v = 7771.37714500204;
|
|
|
|
|
var t = (w + 1.08472) / v;
|
|
|
|
|
t -= (-0.0000331 * t * t + 0.10976 * Math.cos(0.785 + 8328.6914 * t) + 0.02224 * Math.cos(0.187 + 7214.0629 * t) - 0.03342 * Math.cos(4.669 + 628.3076 * t)) / v + (32 * (t + 1.8) * (t + 1.8) - 20) / this.SECOND_PER_DAY / 36525;
|
|
|
|
|
return t * 36525 + this.ONE_THIRD;
|
|
|
|
|
},
|
|
|
|
|
calcShuo:function(jd){
|
|
|
|
|
var size = this.SHUO_KB.length;
|
|
|
|
|
var d = 0;
|
|
|
|
|
var pc = 14;
|
|
|
|
|
var i;
|
|
|
|
|
jd += Solar.J2000;
|
|
|
|
|
var f1 = this.SHUO_KB[0] - pc, f2 = this.SHUO_KB[size - 1] - pc, f3 = 2436935;
|
|
|
|
|
if (jd < f1 || jd >= f3) {
|
|
|
|
|
d = Math.floor(this.shuoHigh(Math.floor((jd + pc - 2451551) / 29.5306) * Math.PI * 2) + 0.5);
|
|
|
|
|
} else if (jd >= f1 && jd < f2) {
|
|
|
|
|
for (i = 0; i < size; i += 2) {
|
|
|
|
|
if (jd + pc < this.SHUO_KB[i + 2]) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d = this.SHUO_KB[i] + this.SHUO_KB[i + 1] * Math.floor((jd + pc - this.SHUO_KB[i]) / this.SHUO_KB[i + 1]);
|
|
|
|
|
d = Math.floor(d + 0.5);
|
|
|
|
|
if (d === 1683460) {
|
|
|
|
|
d++;
|
|
|
|
|
}
|
|
|
|
|
d -= Solar.J2000;
|
|
|
|
|
} else if (jd >= f2 && jd < f3) {
|
|
|
|
|
d = Math.floor(this.shuoLow(Math.floor((jd + pc - 2451551) / 29.5306) * Math.PI * 2) + 0.5);
|
|
|
|
|
var from = Math.floor((jd - f2) / 29.5306);
|
|
|
|
|
var n = this.SB.substr(from, 1);
|
|
|
|
|
if ('1' == n) {
|
|
|
|
|
d += 1;
|
|
|
|
|
} else if ('2' == n) {
|
|
|
|
|
d -= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return d;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var SolarUtil = (function(){
|
|
|
|
|
return {
|
|
|
|
|
WEEK:['日','一','二','三','四','五','六'],
|
|
|
|
|
DAYS_OF_MONTH:[31,28,31,30,31,30,31,31,30,31,30,31],
|
|
|
|
|
XINGZUO:['白羊','金牛','双子','巨蟹','狮子','处女','天秤','天蝎','射手','摩羯','水瓶','双鱼'],
|
|
|
|
|
FESTIVAL:{'1-1':'元旦节','2-14':'情人节','3-8':'妇女节','3-12':'植树节','3-15':'消费者权益日','4-1':'愚人节','5-1':'劳动节','5-4':'青年节','6-1':'儿童节','7-1':'建党节','8-1':'建军节','9-10':'教师节','10-1':'国庆节','12-24':'平安夜','12-25':'圣诞节'},
|
|
|
|
|
OTHER_FESTIVAL:{'1-8':['周恩来逝世纪念日'],'1-10':['中国人民警察节','中国公安110宣传日'],'1-21':['列宁逝世纪念日'],'1-26':['国际海关日'],'2-2':['世界湿地日'],'2-4':['世界抗癌日'],'2-7':['京汉铁路罢工纪念'],'2-10':['国际气象节'],'2-19':['邓小平逝世纪念日'],'2-21':['国际母语日'],'2-24':['第三世界青年日'],'3-1':['国际海豹日'],'3-3':['全国爱耳日'],'3-5':['周恩来诞辰纪念日','中国青年志愿者服务日'],'3-6':['世界青光眼日'],'3-12':['孙中山逝世纪念日'],'3-14':['马克思逝世纪念日'],'3-17':['国际航海日'],'3-18':['全国科技人才活动日'],'3-21':['世界森林日','世界睡眠日'],'3-22':['世界水日'],'3-23':['世界气象日'],'3-24':['世界防治结核病日'],'4-2':['国际儿童图书日'],'4-7':['世界卫生日'],'4-22':['列宁诞辰纪念日'],'4-23':['世界图书和版权日'],'4-26':['世界知识产权日'],'5-3':['世界新闻自由日'],'5-5':['马克思诞辰纪念日'],'5-8':['世界红十字日'],'5-11':['世界肥胖日'],'5-27':['上海解放日'],'5-31':['世界无烟日'],'6-5':['世界环境日'],'6-6':['全国爱眼日'],'6-8':['世界海洋日'],'6-11':['中国人口日'],'6-14':['世界献血日'],'7-1':['香港回归纪念日'],'7-7':['中国人民抗日战争纪念日'],'7-11':['世界人口日'],'8-5':['恩格斯逝世纪念日'],'8-6':['国际电影节'],'8-12':['国际青年日'],'8-22':['邓小平诞辰纪念日'],'9-3':['中国抗日战争胜利纪念日'],'9-8':['世界扫盲日'],'9-9':['毛泽东逝世纪念日'],'9-14':['世界清洁地球日'],'9-18':['九一八事变纪念日'],'9-20':['全国爱牙日'],'9-21':['国际和平日'],'9-27':['世界旅游日'],'10-4':['世界动物日'],'10-10':['辛亥革命纪念日'],'10-13':['中国少年先锋队诞辰日'],'10-25':['抗美援朝纪念日'],'11-12':['孙中山诞辰纪念日'],'11-17':['国际大学生节'],'11-28':['恩格斯诞辰纪念日'],'12-1':['世界艾滋病日'],'12-12':['西安事变纪念日'],'12-13':['国家公祭日'],'12-26':['毛泽东诞辰纪念日']},
|
|
|
|
|
WEEK_FESTIVAL:{'5-2-0':'母亲节','6-3-0':'父亲节','11-4-4':'感恩节'},
|
|
|
|
|
isLeapYear:function(year){return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);},
|
|
|
|
|
getDaysOfMonth:function(year,month){
|
|
|
|
|
var m = month-1;
|
|
|
|
|
var d = this.DAYS_OF_MONTH[m];
|
|
|
|
|
if(m===1&&this.isLeapYear(year)){
|
|
|
|
|
d++;
|
|
|
|
|
}
|
|
|
|
|
return d;
|
|
|
|
|
},
|
|
|
|
|
getDaysOfYear:function(year){
|
|
|
|
|
return this.isLeapYear(year) ? 366: 365;
|
|
|
|
|
},
|
|
|
|
|
getDaysInYear:function(year, month, day){
|
|
|
|
|
var days = 0;
|
|
|
|
|
for (var i = 1; i < month; i++) {
|
|
|
|
|
days += this.getDaysOfMonth(year, i);
|
|
|
|
|
}
|
|
|
|
|
days += day;
|
|
|
|
|
if (1582 === year && 10 === month && day >= 15) {
|
|
|
|
|
days -= 10;
|
|
|
|
|
}
|
|
|
|
|
return days;
|
|
|
|
|
},
|
|
|
|
|
getWeeksOfMonth:function(year,month,start){
|
|
|
|
|
var days = this.getDaysOfMonth(year,month);
|
|
|
|
|
var firstDate = ExactDate.fromYmd(year,month,1);
|
|
|
|
|
var firstDayWeek = firstDate.getDay();
|
|
|
|
|
return Math.ceil((days+firstDayWeek-start)/7);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var LunarUtil = (function(){
|
|
|
|
|
return {
|
|
|
|
|
BASE_MONTH_ZHI_INDEX:2,
|
|
|
|
|
XUN:['甲子','甲戌','甲申','甲午','甲辰','甲寅'],
|
|
|
|
|
XUN_KONG:['戌亥','申酉','午未','辰巳','寅卯','子丑'],
|
|
|
|
|
LIU_YAO:['先胜','友引','先负','佛灭','大安','赤口'],
|
|
|
|
|
HOU:['初候','二候','三候'],
|
|
|
|
|
WU_HOU:['蚯蚓结','麋角解','水泉动','雁北乡','鹊始巢','雉始雊','鸡始乳','征鸟厉疾','水泽腹坚','东风解冻','蛰虫始振','鱼陟负冰','獭祭鱼','候雁北','草木萌动','桃始华','仓庚鸣','鹰化为鸠','玄鸟至','雷乃发声','始电','桐始华','田鼠化为鴽','虹始见','萍始生','鸣鸠拂奇羽','戴胜降于桑','蝼蝈鸣','蚯蚓出','王瓜生','苦菜秀','靡草死','麦秋至','螳螂生','鵙始鸣','反舌无声','鹿角解','蜩始鸣','半夏生','温风至','蟋蟀居壁','鹰始挚','腐草为萤','土润溽暑','大雨行时','凉风至','白露降','寒蝉鸣','鹰乃祭鸟','天地始肃','禾乃登','鸿雁来','玄鸟归','群鸟养羞','雷始收声','蛰虫坯户','水始涸','鸿雁来宾','雀入大水为蛤','菊有黄花','豺乃祭兽','草木黄落','蛰虫咸俯','水始冰','地始冻','雉入大水为蜃','虹藏不见','天气上升地气下降','闭塞而成冬','鹖鴠不鸣','虎始交','荔挺出'],
|
|
|
|
|
GAN:['','甲','乙','丙','丁','戊','己','庚','辛','壬','癸'],
|
|
|
|
|
POSITION_XI:['','艮','乾','坤','离','巽','艮','乾','坤','离','巽'],
|
|
|
|
|
POSITION_YANG_GUI:['','坤','坤','兑','乾','艮','坎','离','艮','震','巽'],
|
|
|
|
|
POSITION_YIN_GUI:['','艮','坎','乾','兑','坤','坤','艮','离','巽','震'],
|
|
|
|
|
POSITION_FU:['','巽','巽','震','震','坎','离','坤','坤','乾','兑'],
|
|
|
|
|
POSITION_FU_2:['','坎','坤','乾','巽','艮','坎','坤','乾','巽','艮'],
|
|
|
|
|
POSITION_CAI:['','艮','艮','坤','坤','坎','坎','震','震','离','离'],
|
|
|
|
|
POSITION_TAI_SUI_YEAR: ['坎','艮','艮','震','巽','巽','离','坤','坤','兑','坎','坎'],
|
|
|
|
|
POSITION_GAN: ['震','震','离','离','中','中','兑','兑','坎','坎'],
|
|
|
|
|
POSITION_ZHI: ['坎','中','震','震','中','离','离','中','兑','兑','中','坎'],
|
|
|
|
|
POSITION_TAI_DAY:['占门碓 外东南','碓磨厕 外东南','厨灶炉 外正南','仓库门 外正南','房床栖 外正南','占门床 外正南','占碓磨 外正南','厕灶厨 外西南','仓库炉 外西南','房床门 外西南','门碓栖 外西南','碓磨床 外西南','厨灶碓 外西南','仓库厕 外正西','房床炉 外正西','占大门 外正西','碓磨栖 外正西','厨房床 外正西','仓库碓 外西北','房床厕 外西北','占门炉 外西北','门碓磨 外西北','厨灶栖 外西北','仓库床 外西北','房床碓 外正北','占门厕 外正北','碓磨炉 外正北','厨灶门 外正北','仓库栖 外正北','占房床 房内北','占门碓 房内北','碓磨厕 房内北','厨灶炉 房内北','门仓库 房内北','床房栖 房内中','占门床 房内中','占碓磨 房内南','厨磨厕 房内南','仓库炉 房内南','房床门 房内西','门碓栖 房内东','碓磨床 房内东','厨灶碓 房内东','仓库厕 房内东','房床炉 房内中','占大门 外东北','碓磨栖 外东北','厨灶床 外东北','仓库碓 外东北','房床厕 外东北','占门炉 外东北','门碓磨 外正东','厨灶栖 外正东','仓库床 外正东','房床碓 外正东','占门厕 外正东','碓磨炉 外东南','厨灶门 外东南','仓库栖 外东南','占房床 外东南'],
|
|
|
|
|
POSITION_TAI_MONTH:['占房床','占户窗','占门堂','占厨灶','占房床','占床仓','占碓磨','占厕户','占门房','占房床','占灶炉','占房床'],
|
|
|
|
|
ZHI:['','子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'],
|
|
|
|
|
ZHI_XING:['','建','除','满','平','定','执','破','危','成','收','开','闭'],
|
|
|
|
|
JIA_ZI:['甲子','乙丑','丙寅','丁卯','戊辰','己巳','庚午','辛未','壬申','癸酉','甲戌','乙亥','丙子','丁丑','戊寅','己卯','庚辰','辛巳','壬午','癸未','甲申','乙酉','丙戌','丁亥','戊子','己丑','庚寅','辛卯','壬辰','癸巳','甲午','乙未','丙申','丁酉','戊戌','己亥','庚子','辛丑','壬寅','癸卯','甲辰','乙巳','丙午','丁未','戊申','己酉','庚戌','辛亥','壬子','癸丑','甲寅','乙卯','丙辰','丁巳','戊午','己未','庚申','辛酉','壬戌','癸亥'],
|
|
|
|
|
TIAN_SHEN:['','青龙','明堂','天刑','朱雀','金匮','天德','白虎','玉堂','天牢','玄武','司命','勾陈'],
|
|
|
|
|
ZHI_TIAN_SHEN_OFFSET:{'子':4,'丑':2,'寅':0,'卯':10,'辰':8,'巳':6,'午':4,'未':2,'申':0,'酉':10,'戌':8,'亥':6},
|
|
|
|
|
TIAN_SHEN_TYPE:{'青龙':'黄道','明堂':'黄道','金匮':'黄道','天德':'黄道','玉堂':'黄道','司命':'黄道','天刑':'黑道','朱雀':'黑道','白虎':'黑道','天牢':'黑道','玄武':'黑道','勾陈':'黑道'},
|
|
|
|
|
TIAN_SHEN_TYPE_LUCK:{'黄道':'吉','黑道':'凶'},
|
|
|
|
|
PENGZU_GAN:['','甲不开仓财物耗散','乙不栽植千株不长','丙不修灶必见灾殃','丁不剃头头必生疮','戊不受田田主不祥','己不破券二比并亡','庚不经络织机虚张','辛不合酱主人不尝','壬不泱水更难提防','癸不词讼理弱敌强'],
|
|
|
|
|
PENGZU_ZHI:['','子不问卜自惹祸殃','丑不冠带主不还乡','寅不祭祀神鬼不尝','卯不穿井水泉不香','辰不哭泣必主重丧','巳不远行财物伏藏','午不苫盖屋主更张','未不服药毒气入肠','申不安床鬼祟入房','酉不会客醉坐颠狂','戌不吃犬作怪上床','亥不嫁娶不利新郎'],
|
|
|
|
|
NUMBER:['〇','一','二','三','四','五','六','七','八','九','十','十一','十二'],
|
|
|
|
|
MONTH:['','正','二','三','四','五','六','七','八','九','十','冬','腊'],
|
|
|
|
|
SEASON:['','孟春','仲春','季春','孟夏','仲夏','季夏','孟秋','仲秋','季秋','孟冬','仲冬','季冬'],
|
|
|
|
|
SHENGXIAO:['','鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪'],
|
|
|
|
|
DAY:['','初一','初二','初三','初四','初五','初六','初七','初八','初九','初十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','廿一','廿二','廿三','廿四','廿五','廿六','廿七','廿八','廿九','三十'],
|
|
|
|
|
YUE_XIANG:['','朔','既朔','蛾眉新','蛾眉新','蛾眉','夕月','上弦','上弦','九夜','宵','宵','宵','渐盈凸','小望','望','既望','立待','居待','寝待','更待','渐亏凸','下弦','下弦','有明','有明','蛾眉残','蛾眉残','残','晓','晦'],
|
|
|
|
|
XIU:{'申1':'毕','申2':'翼','申3':'箕','申4':'奎','申5':'鬼','申6':'氐','申0':'虚','子1':'毕','子2':'翼','子3':'箕','子4':'奎','子5':'鬼','子6':'氐','子0':'虚','辰1':'毕','辰2':'翼','辰3':'箕','辰4':'奎','辰5':'鬼','辰6':'氐','辰0':'虚','巳1':'危','巳2':'觜','巳3':'轸','巳4':'斗','巳5':'娄','巳6':'柳','巳0':'房','酉1':'危','酉2':'觜','酉3':'轸','酉4':'斗','酉5':'娄','酉6':'柳','酉0':'房','丑1':'危','丑2':'觜','丑3':'轸','丑4':'斗','丑5':'娄','丑6':'柳','丑0':'房','寅1':'心','寅2':'室','寅3':'参','寅4':'角','寅5':'牛','寅6':'胃','寅0':'星','午1':'心','午2':'室','午3':'参','午4':'角','午5':'牛','午6':'胃','午0':'星','戌1':'心','戌2':'室','戌3':'参','戌4':'角','戌5':'牛','戌6':'胃','戌0':'星','亥1':'张','亥2':'尾','亥3':'壁','亥4':'井','亥5':'亢','亥6':'女','亥0':'昴','卯1':'张','卯2':'尾','卯3':'壁','卯4':'井','卯5':'亢','卯6':'女','卯0':'昴','未1':'张','未2':'尾','未3':'壁','未4':'井','未5':'亢','未6':'女','未0':'昴'},
|
|
|
|
|
XIU_LUCK:{'角':'吉','亢':'凶','氐':'凶','房':'吉','心':'凶','尾':'吉','箕':'吉','斗':'吉','牛':'凶','女':'凶','虚':'凶','危':'凶','室':'吉','壁':'吉','奎':'凶','娄':'吉','胃':'吉','昴':'凶','毕':'吉','觜':'凶','参':'吉','井':'吉','鬼':'凶','柳':'凶','星':'凶','张':'吉','翼':'凶','轸':'吉'},
|
|
|
|
|
XIU_SONG:{'角':'角星造作主荣昌,外进田财及女郎,嫁娶婚姻出贵子,文人及第见君王,惟有埋葬不可用,三年之后主瘟疫,起工修筑坟基地,堂前立见主人凶。','亢':'亢星造作长房当,十日之中主有殃,田地消磨官失职,接运定是虎狼伤,嫁娶婚姻用此日,儿孙新妇守空房,埋葬若还用此日,当时害祸主重伤。','氐':'氐星造作主灾凶,费尽田园仓库空,埋葬不可用此日,悬绳吊颈祸重重,若是婚姻离别散,夜招浪子入房中,行船必定遭沉没,更生聋哑子孙穷。','房':'房星造作田园进,钱财牛马遍山岗,更招外处田庄宅,荣华富贵福禄康,埋葬若然用此日,高官进职拜君王,嫁娶嫦娥至月殿,三年抱子至朝堂。','心':'心星造作大为凶,更遭刑讼狱囚中,忤逆官非宅产退,埋葬卒暴死相从,婚姻若是用此日,子死儿亡泪满胸,三年之内连遭祸,事事教君没始终。','尾':'尾星造作主天恩,富贵荣华福禄增,招财进宝兴家宅,和合婚姻贵子孙,埋葬若能依此日,男清女正子孙兴,开门放水招田宅,代代公侯远播名。','箕':'箕星造作主高强,岁岁年年大吉昌,埋葬修坟大吉利,田蚕牛马遍山岗,开门放水招田宅,箧满金银谷满仓,福荫高官加禄位,六亲丰禄乐安康。','斗':'斗星造作主招财,文武官员位鼎台,田宅家财千万进,坟堂修筑贵富来,开门放水招牛马,旺蚕男女主和谐,遇此吉宿来照护,时支福庆永无灾。','牛':'牛星造作主灾危,九横三灾不可推,家宅不安人口退,田蚕不利主人衰,嫁娶婚姻皆自损,金银财谷渐无之,若是开门并放水,牛猪羊马亦伤悲。','女':'女星造作损婆娘,兄弟相嫌似虎狼,埋葬生灾逢鬼怪,颠邪疾病主瘟惶,为事遭官财失散,泻利留连不可当,开门放水用此日,全家财散主离乡。','虚':'虚星造作主灾殃,男女孤眠不一双,内乱风声无礼节,儿孙媳妇伴人床,开门放水遭灾祸,虎咬蛇伤又卒亡,三三五五连年病,家破人亡不可当。','危':'危星不可造高楼,自遭刑吊见血光,三年孩子遭水厄,后生出外永不还,埋葬若还逢此日,周年百日取高堂,三年两载一悲伤,开门放水到官堂。','室':'室星修造进田牛,儿孙代代近王侯,家贵荣华天上至,寿如彭祖八千秋,开门放水招财帛,和合婚姻生贵儿,埋葬若能依此日,门庭兴旺福无休。','壁':'壁星造作主增财,丝蚕大熟福滔天,奴婢自来人口进,开门放水出英贤,埋葬招财官品进,家中诸事乐陶然,婚姻吉利主贵子,早播名誉著祖鞭。','奎':'奎星造作得祯祥,家内荣和大吉昌,若是埋葬阴卒死,当年定主两三伤,看看军令刑伤到,重重官事主瘟惶,开门放水遭灾祸,三年两次损儿郎。','娄':'娄星修造起门庭,财旺家和事事兴,外进钱财百日进,一家兄弟播高名,婚姻进益生贵子,玉帛金银箱满盈,放水开门皆吉利,男荣女贵寿康宁。','胃':'胃星造作事如何,家贵荣华喜气多,埋葬贵临官禄位,夫妇齐眉永保康,婚姻遇此家富贵,三灾九祸不逢他,从此门前多吉庆,儿孙代代拜金阶。','昴':'昴星造作进田牛,埋葬官灾不得休,重丧二日三人死,尽卖田园不记增,开门放水招灾祸,三岁孩儿白了头,婚姻不可逢此日,死别生离是可愁。','毕':'毕星造作主光前,买得田园有余钱,埋葬此日添官职,田蚕大熟永丰年,开门放水多吉庆,合家人口得安然,婚姻若得逢此日,生得孩儿福寿全。','觜':'觜星造作有徒刑,三年必定主伶丁,埋葬卒死多因此,取定寅年使杀人,三丧不止皆由此,一人药毒二人身,家门田地皆退败,仓库金银化作尘。','参':'参星造作旺人家,文星照耀大光华,只<EFBFBD>
|
|
|
|
|
ZHENG:{'角':'木','井':'木','奎':'木','斗':'木','亢':'金','鬼':'金','娄':'金','牛':'金','氐':'土','柳':'土','胃':'土','女':'土','房':'日','星':'日','昴':'日','虚':'日','心':'月','张':'月','毕':'月','危':'月','尾':'火','翼':'火','觜':'火','室':'火','箕':'水','轸':'水','参':'水','壁':'水' },
|
|
|
|
|
ANIMAL:{'角':'蛟','斗':'獬','奎':'狼','井':'犴','亢':'龙','牛':'牛','娄':'狗','鬼':'羊','女':'蝠','氐':'貉','胃':'彘','柳':'獐','房':'兔','虚':'鼠','昴':'鸡','星':'马','心':'狐','危':'燕','毕':'乌','张':'鹿','尾':'虎','室':'猪','觜':'猴','翼':'蛇','箕':'豹','壁':'獝','参':'猿','轸':'蚓' },
|
|
|
|
|
GONG:{'角':'东','井':'南','奎':'西','斗':'北','亢':'东','鬼':'南','娄':'西','牛':'北','氐':'东','柳':'南','胃':'西','女':'北','房':'东','星':'南','昴':'西','虚':'北','心':'东','张':'南','毕':'西','危':'北','尾':'东','翼':'南','觜':'西','室':'北','箕':'东','轸':'南','参':'西','壁':'北' },
|
|
|
|
|
SHOU:{'东':'青龙','南':'朱雀','西':'白虎','北':'玄武'},
|
|
|
|
|
FESTIVAL:{'1-1':'春节','1-15':'元宵节','2-2':'龙头节','5-5':'端午节','7-7':'七夕节','8-15':'中秋节','9-9':'重阳节','12-8':'腊八节'},
|
|
|
|
|
OTHER_FESTIVAL:{'1-4':['接神日'],'1-5':['隔开日'],'1-7':['人日'],'1-8':['谷日','顺星节'],'1-9':['天日'],'1-10':['地日'],'1-20':['天穿节'],'1-25':['填仓节'],'1-30':['正月晦'],'2-1':['中和节'],'2-2':['春社'],'3-3':['上巳节'],'5-20':['分龙节'],'5-25':['会龙节'],'6-6':['天贶节'],'6-24':['观莲节'],'6-25':['五谷母节'],'7-14':['中元节'],'7-22':['财神节'],'7-29':['地藏节'],'8-1':['天灸日'],'10-1':['寒衣节'],'10-10':['十成节'],'10-15':['下元节'],'12-7':['驱傩日'],'12-16':['尾牙'],'12-24':['祭灶日']},
|
|
|
|
|
CHONG:{'子':'午','丑':'未','寅':'申','卯':'酉','辰':'戌','巳':'亥','午':'子','未':'丑','申':'寅','酉':'卯','戌':'辰','亥':'巳'},
|
|
|
|
|
CHONG_GAN:{'甲':'戊','乙':'己','丙':'庚','丁':'辛','戊':'壬','己':'癸','庚':'甲','辛':'乙','壬':'丙','癸':'丁'},
|
|
|
|
|
CHONG_GAN_BAD:{'庚':'甲','辛':'乙','壬':'丙','癸':'丁'},
|
|
|
|
|
CHONG_GAN_TIE:{'甲':'己','乙':'戊','丙':'辛','丁':'庚','戊':'癸','己':'壬','庚':'乙','辛':'甲','壬':'丁','癸':'丙'},
|
|
|
|
|
CHONG_GAN_TIE_GOOD:{'甲':'己','丙':'辛','戊':'癸','庚':'乙','壬':'丁'},
|
|
|
|
|
SHA:{'子':'南','丑':'东','寅':'北','卯':'西','辰':'南','巳':'东','午':'北','未':'西','申':'南','酉':'东','戌':'北','亥':'西'},
|
|
|
|
|
POSITION_DESC:{'坎':'正北','艮':'东北','震':'正东','巽':'东南','离':'正南','坤':'西南','兑':'正西','乾':'西北','中':'中宫'},
|
|
|
|
|
NAYIN:{'甲子':'海中金','甲午':'沙中金','丙寅':'炉中火','丙申':'山下火','戊辰':'大林木','戊戌':'平地木','庚午':'路旁土','庚子':'壁上土','壬申':'剑锋金','壬寅':'金箔金','甲戌':'山头火','甲辰':'覆灯火','丙子':'涧下水','丙午':'天河水','戊寅':'城头土','戊申':'大驿土','庚辰':'白蜡金','庚戌':'钗钏金','壬午':'杨柳木','壬子':'桑柘木','甲申':'泉中水','甲寅':'大溪水','丙戌':'屋上土','丙辰':'沙中土','戊子':'霹雳火','戊午':'天上火','庚寅':'松柏木','庚申':'石榴木','壬辰':'长流水','壬戌':'大海水','乙丑':'海中金','乙未':'沙中金','丁卯':'炉中火','丁酉':'山下火','己巳':'大林木','己亥':'平地木','辛未':'路旁土','辛丑':'壁上土','癸酉':'剑锋金','癸卯':'金箔金','乙亥':'山头火','乙巳':'覆灯火','丁丑':'涧下水','丁未':'天河水','己卯':'城头土','己酉':'大驿土','辛巳':'白蜡金','辛亥':'钗钏金','癸未':'杨柳木','癸丑':'桑柘木','乙酉':'泉中水','乙卯':'大溪水','丁亥':'屋上土','丁巳':'沙中土','己丑':'霹雳火','己未':'天上火','辛卯':'松柏木','辛酉':'石榴木','癸巳':'长流水','癸亥':'大海水'},
|
|
|
|
|
WU_XING_GAN:{'甲':'木','乙':'木','丙':'火','丁':'火','戊':'土','己':'土','庚':'金','辛':'金','壬':'水','癸':'水'},
|
|
|
|
|
WU_XING_ZHI:{'寅':'木','卯':'木','巳':'火','午':'火','辰':'土','丑':'土','戌':'土','未':'土','申':'金','酉':'金','亥':'水','子':'水'},
|
|
|
|
|
SHI_SHEN_GAN:{'甲甲':'比肩','甲乙':'劫财','甲丙':'食神','甲丁':'伤官','甲戊':'偏财','甲己':'正财','甲庚':'七杀','甲辛':'正官','甲壬':'偏印','甲癸':'正印','乙乙':'比肩','乙甲':'劫财','乙丁':'食神','乙丙':'伤官','乙己':'偏财','乙戊':'正财','乙辛':'七杀','乙庚':'正官','乙癸':'偏印','乙壬':'正印','丙丙':'比肩','丙丁':'劫财','丙戊':'食神','丙己':'伤官','丙庚':'偏财','丙辛':'正财','丙壬':'七杀','丙癸':'正官','丙甲':'偏印','丙乙':'正印','丁丁':'比肩','丁丙':'劫财','丁己':'食神','丁戊':'伤官','丁辛':'偏财','丁庚':'正财','丁癸':'七杀','丁壬':'正官','丁乙':'偏印','丁甲':'正印','戊戊':'比肩','戊己':'劫财','戊庚':'食神','戊辛':'伤官','戊壬':'偏财','戊癸':'正财','戊甲':'七杀','戊乙':'正官','戊丙':'偏印','戊丁':'正印','己己':'比肩','己戊':'劫财','己辛':'食神','己庚':'伤官','己癸':'偏财','己壬':'正财','己乙':'七杀','己甲':'正官','己丁':'偏印','己丙':'正印','庚庚':'比肩','庚辛':'劫财','庚壬':'食神','庚癸':'伤官','庚甲':'偏财','庚乙':'正财','庚丙':'七杀','庚丁':'正官','庚戊':'偏印','庚己':'正印','辛辛':'比肩','辛庚':'劫财','辛癸':'食神','辛壬':'伤官','辛乙':'偏财','辛甲':'正财','辛丁':'七杀','辛丙':'正官','辛己':'偏印','辛戊':'正印','壬壬':'比肩','壬癸':'劫财','壬甲':'食神','壬乙':'伤官','壬丙':'偏财','壬丁':'正财','壬戊':'七杀','壬己':'正官','壬庚':'偏印','壬辛':'正印','癸癸':'比肩','癸壬':'劫财','癸乙':'食神','癸甲':'伤官','癸丁':'偏财','癸丙':'正财','癸己':'七杀','癸戊':'正官','癸辛':'偏印','癸庚':'正印'},
|
|
|
|
|
SHI_SHEN_ZHI:{'甲子癸':'正印','甲丑癸':'正印','甲丑己':'正财','甲丑辛':'正官','甲寅丙':'食神','甲寅甲':'比肩','甲寅戊':'偏财','甲卯乙':'劫财','甲辰乙':'劫财','甲辰戊':'偏财','甲辰癸':'正印','甲巳戊':'偏财','甲巳丙':'食神','甲巳庚':'七杀','甲午丁':'伤官','甲午己':'正财','甲未乙':'劫财','甲未己':'正财','甲未丁':'伤官','甲申戊':'偏财','甲申庚':'七杀','甲申壬':'偏印','甲酉辛':'正官','甲戌辛':'正官','甲戌戊':'偏财','甲戌丁':'伤官','甲亥壬':'偏印','甲亥甲':'比肩','乙子癸':'偏印','乙丑癸':'偏印','乙丑己':'偏财','乙丑辛':'七杀','乙寅丙':'伤官','乙寅甲':'劫财','乙寅戊':'正财','乙卯乙':'比肩','乙辰乙':'比肩','乙辰戊':'正财','乙辰癸':'偏印','乙巳戊':'正财','乙巳丙':'伤官','乙巳庚':'正官','乙午丁':'食神','乙午己':'偏财','乙未乙':'比肩','乙未己':'偏财','乙未丁':'食神','乙申戊':'正财','乙申庚':'正官','乙申壬':'正印','乙酉辛':'七杀','乙戌辛':'七杀','乙戌戊':'正财','乙戌丁':'食神','乙亥壬':'正印','乙亥甲':'劫财','丙子癸':'正官','丙丑癸':'正官','丙丑己':'伤官','丙丑辛':'正财','丙寅丙':'比肩','丙寅甲':'偏印','丙寅戊':'食神','丙卯乙':'正印','丙辰乙':'正印','丙辰戊':'食神','丙辰癸':'正官','丙巳戊':'食神','丙巳丙':'比肩','丙巳庚':'偏财','丙午丁':'劫财','丙午己':'伤官','丙未乙':'正印','丙未己':'伤官','丙未丁':'劫财','丙申戊':'食神','丙申庚':'偏财','丙申壬':'七杀','丙酉辛':'正财','丙戌辛':'正财','丙戌戊':'食神','丙戌丁':'劫财','丙亥壬':'七杀','丙亥甲':'偏印','丁子癸':'七杀','丁丑癸':'七杀','丁丑己':'食神','丁丑辛':'偏财','丁寅丙':'劫财','丁寅甲':'正印','丁寅戊':'伤官','丁卯乙':'偏印','丁辰乙':'偏印','丁辰戊':'伤官','丁辰癸':'七杀','丁巳戊':'伤官','丁巳丙':'劫财','丁巳庚':'正财','丁午丁':'比肩','丁午己':'食神','丁未乙':'偏印','丁未己':'食神','丁未丁':'比肩','丁申戊':'伤官','丁申庚':'正财','丁申壬':'正官','丁酉辛':'偏财','丁戌辛':'偏财','丁戌戊':'伤官','丁戌丁':'比肩','丁亥壬':'正官','丁亥甲':'正印','戊子癸':'正财','戊丑癸':'正财','戊丑己':'劫财','戊丑辛':'伤官','戊寅丙':'偏印','戊寅甲':'七杀','戊寅戊':'比肩','戊卯乙':'正官','戊辰乙':'正官','戊辰戊':'比肩','戊辰癸':'正财','戊巳戊':'比肩','戊巳丙':'偏印','戊巳庚':'食神','戊午丁':'正印','戊午己':'劫财','戊未乙':'正官','戊未己':'劫财','戊未丁':'正印','戊申戊':'比肩','戊申庚':'食神','戊申壬':'偏财','戊酉辛':'伤官','戊戌辛':'伤官','戊戌戊':'比肩','戊戌丁':'正印','戊亥壬':'偏财','戊亥甲':'七杀','己子癸':'偏财','己丑癸':'偏财','己丑己':'比肩','己丑辛':'食神','己寅丙':'正印','己寅甲':'正官','己寅戊':'劫财','己卯乙':'七杀','己辰乙':'七杀','己辰戊':'劫财','己辰癸':'偏财','己巳戊':'劫财','己巳丙':'正印','己巳庚':'伤官','己午丁':'偏印','己午己':'比肩','己未乙':'七杀','己未己':'比肩','己未丁':'偏印','己申戊':'劫财','己申庚':'伤官','己申壬':'正财','己酉辛':'食神','己戌辛':'食神','己戌戊':'劫财','己戌丁':'偏印','己亥壬':'正财','己亥甲':'正官','庚子癸':'伤官','庚丑癸':'伤官','庚丑己':'正印','庚丑辛':'劫财','庚寅丙':'七杀','庚寅甲':'偏财','庚寅戊':'偏印','庚卯乙':'正财','庚辰乙':'正财','庚辰戊':'偏印','庚辰癸':'伤官','庚巳戊':'偏印','庚巳丙':'七杀','庚巳庚':'比肩','庚午丁':'正官','庚午己':'正印','庚未乙':'正财','庚未己':'正印','庚未丁':'正官','庚申戊':'偏印','庚申庚':'比肩','庚申壬':'食神','庚酉辛':'劫财','庚戌辛':'劫财','庚戌戊':'偏印','庚戌丁':'正官','
|
|
|
|
|
ZHI_HIDE_GAN:{'子':['癸'],'丑':['己','癸','辛'],'寅':['甲','丙','戊'],'卯':['乙'],'辰':['戊','乙','癸'],'巳':['丙','庚','戊'],'午':['丁','己'],'未':['己','丁','乙'],'申':['庚','壬','戊'],'酉':['辛'],'戌':['戊','辛','丁'],'亥':['壬','甲']},
|
|
|
|
|
YI_JI:['祭祀','祈福','求嗣','开光','塑绘','齐醮','斋醮','沐浴','酬神','造庙','祀灶','焚香','谢土','出火','雕刻','嫁娶','订婚','纳采','问名','纳婿','归宁','安床','合帐','冠笄','订盟','进人口','裁衣','挽面','开容','修坟','启钻','破土','安葬','立碑','成服','除服','开生坟','合寿木','入殓','移柩','普渡','入宅','安香','安门','修造','起基','动土','上梁','竖柱','开井开池','作陂放水','拆卸','破屋','坏垣','补垣','伐木做梁','作灶','解除','开柱眼','穿屏扇架','盖屋合脊','开厕','造仓','塞穴','平治道涂','造桥','作厕','筑堤','开池','伐木','开渠','掘井','扫舍','放水','造屋','合脊','造畜稠','修门','定磉','作梁','修饰垣墙','架马','开市','挂匾','纳财','求财','开仓','买车','置产','雇庸','出货财','安机械','造车器','经络','酝酿','作染','鼓铸','造船','割蜜','栽种','取渔','结网','牧养','安碓磑','习艺','入学','理发','探病','见贵','乘船','渡水','针灸','出行','移徙','分居','剃头','整手足甲','纳畜','捕捉','畋猎','教牛马','会亲友','赴任','求医','治病','词讼','起基动土','破屋坏垣','盖屋','造仓库','立券交易','交易','立券','安机','会友','求医疗病','诸事不宜','馀事勿取','行丧','断蚁','归岫','无'],
|
|
|
|
|
LU:{'甲':'寅','乙':'卯','丙':'巳','丁':'午','戊':'巳','己':'午','庚':'申','辛':'酉','壬':'亥','癸':'子','寅':'甲','卯':'乙','巳':'丙,戊','午':'丁,己','申':'庚','酉':'辛','亥':'壬','子':'癸'},
|
|
|
|
|
DAY_YI_JI:'30=192531010D:838454151A4C200C1E23221D212726,030F522E1F00=2430000C18:8319000776262322200C1E1D,06292C2E1F04=32020E1A26:791715795B0001025D,0F522E38201D=162E3A0A22:790F181113332C2E2D302F157954,7001203810=0E1A263202:79026A176576036A,522E201F05=0D19250131:7911192C2E302F00030401060F1571292A75,707C20522F=0C18243000:4F2C2E2B383F443D433663,0F01478A20151D=0E1A320226:3840,0001202B892F=14202C3808:3807504089,8829=0E1A263202:383940,6370018A75202B454F6605=32020E1A26:38394089,0001202B22=16223A0A2E:384C,8A2020=2B3707131F:2C2E5B000739337C38802D44484C2425201F1E272621,5229701535=121E2A3606:2C2E2D2B156343364C,0F4729710D708A20036A1904=0D19250131:5040262789,0F7129033B=202C380814:5040000738,0F7D7C584F012063452B35=1A2632020E:50400089,8813=1A2632020E:69687011180F791966762627201E,0352292E8034=182430000C:291503000D332E53261F2075,0F5238584F450B=000C182430:297170192C2E2D2F2B3E363F4C,0F52156320010347200B=131F2B3707:297115030102195283840D332C2E,0F1F5863201D8A02=222E3A0A16:261F1E20232289,52290058363F32=16222E3A0A:261F201E232289,8D39=0D19310125:262322271E201D21,52450F4F09=0D19253101:262322271E202189,1F4526=16222E3A0A:262322271F1E20,712906=0F1B273303:17262322274050,80387C6B2C=0915212D39:1707702C2E71291F20,0F52000106111D15=16222E3A0A:170007386A7448363F261F1E,030F79636F2026=030F1B2733:1784832C2E5B26201F,0F010D2913=182430000C:175447440D15838477656A49,2B2E1F8A202228=101C283404:70504C7889,8803=0D19250131:700F181126151E20001A7919,8D2F=0915212D39:705283845B0D2F71,0F202E4106=3606121E2A:70786289,06802E1F23=1824000C30:70076A363F,292017=202C380814:700718111A302F717566,0F2B2E2026=3B0B17232F:70545283842E71291A7933192A5D5A5040,090C384F45208A1D6B38=212D390915:7039170F45513A2C2E7129242526271F201D,00010352153A=15212D3909:703911170E2C2E2D2F4B15712952633D,092B8A2027=010D192531:702D155483840F63262720,53292F017D4F38442B2E1F4717=16222E3A0A:705C4C39171A4F0E7971295B4C5248,0F2E1F1D37=1A2632020E:2E260F27201F,523815292F1A22=0E1A260232:64262322271F2021,0F2F293822=2F3B0B1723:161A0F1526271F4C,586103473818=2430000C18:161A7889,292E1F0F386131=17232F3B0B:04795B3F651A5D,0F5201062016=14202C3808:04170F79195D1A637566363F76,01522E8A2039=132B37071F:0470170F191A134C8384662426232227201E,8D08=0D19253101:040370181123220F1326271E2021,29153B=0D19310125:040307177938494C,0F26207017=0E2632021A:0403010218111A17332C2E2D2B15713E6575,45382064291D=142C380820:04033918110F0D2C2E7129332D2B72528384547566,8D1C=1830000C24:040318111A17332C15290D200C7A,4745063835=0F2733031B:040318111A16175B795452848315302F6563395D,387029202E=14202C3808:04031975363F6366,0F5401202C5283842E2F1E=0E1A320226:0403080618111A16332E2F152A09537919702C5445490D75072B,8063203820=182430000C:04067033392C7161262322271E1D210C,8D2F=101C283404:3F4889,881C=2733030F1B:3F74397677658988,0F3847201D=293505111D:3F8B657789,0F2029702E7D35=111D293505:3F8B6589,1F200A=020E1A2632:3F656477,0F2B71292005=111D290535:3F6589,8810=0F1B273303:3F88,2B38200F1C=293505111D:0F83843D363F776424,15462F2C52032971152A=0F1B273303:0F17795B54838458,52807C3811=121E2A3606:0F172C2E387129363F7566512C2E2D4E4461,01034752203A=172F3B0B23:0F171511793F76584C,0347200C1D20=2D39091521:0F175B3975660745514F2B4825201E211D,010352292E2E=0F1B273303:0F170070792C2E261F,040341232228=05111D2935:0F1700707129385C363F3D1F1E232226,80412B202F14=14202C3808:0F17000728705448757A,522E1F15562F05=30000C1824:0F17000102061979454F3A15477677,241F8A2021=2F3B0B1723:0F17000102060370392E52838453331F,452F2C266A79292B203810=0C18243000:0F170001020E032A70692C2E302F802D2B0D7129474C201F2322,5211183809615D34=1A2632020E:0F171170792F5B1566770001032C2B802D,29387C207134=14202C3808:0F0D33000103452E528384297115752620,63386F7014=15212D3909:0F7045332C2E71201F1D21,4701155229530327=101C283404:0F70161715232238838426271F20,7D035219=121E2A3606:0F705B0004037C5D15653F1F26,522B473809=131F2B0737:0F705215261E20,012E1F25=182430000C:0F707B7C00012F75,52201B=2531010D19:0F706A151E201D528384544466,47010C2E292F2C3820=14202C3808:0F707500261E20,382E1F05=3606121E2A:0F161A17452F0D33712C2E2B5443633F,150170208A0327=0E1A263202:0F150370002E0D3979528384532971331F1E20,477D0D=06121E2A36:0F5B8370000102060403161A494447,386A418A201A=17232F3B0B:0F03700D33
|
|
|
|
|
TIME_YI_JI:'0D28=,2C2E2128=,2C2E0110=,2C2E0C1F=,2C2E7A701B1C=,01022308=,01026D003026=,000106037A702D02=,000106037A702802=,000106037A703131=,000106037A70341B=,000106087A701F0E=,000106087A702E15=,000106087A702C2E0E39=,000106087A702C2E0D2B=,881727=,88032D=,88352F=,882B2F=,882125=,882A22=,880C1E=,880220=,88161A=,882018=,883422=,880113=,880B11=,883315=,882915=,881F17=,88150D=,88122E=,88302A=,88262A=,883A28=,880826=,881C2C=,881905=,882303=,880F09=,88050B=,883701=,882D01=,88060C=,882410=,881A12=,882E0E=,88380E=,881010=,883630=,881834=,880E38=,882232=,882C30=,88043A=,881E0A=,880006=,883208=,880A04=,881400=,882808=,883137=,883B35=,882737=,881D39=,88133B=,880933=,88251D=,882F1B=,881B1F=,88111D=,880719=,88391B=,88212D=,7A702C0B15=,7A70551515=,7A70552D00=,7A7D2C2E1334=382C,000106083528=382C,7A70000106080504=382C7A6C55700F197120,00010608223A=380006082C,01026D0D2C=380006082C,01027A70551D30=380006082C0F71295283,01027A703636=380006082C0F71295283,0102416D1226=380006082C7A706C550F297120,0102251C=380006082C7A6C55700F197120,01026D2300=3800010608,2C2E0324=3800010608,7A702C2E082E=3800010608,7A70552C2E3B34=38000106082C,2F8026330C=38000106082C,2F80267A701622=38000106082C7A70556C0F197120,1904=38000106082C7A6C55700F197120,1514=38000106087A70556C0F197120,2C2E3138=38000106087A70556C0F197120,2C2E0B10=38000106087A6C55700F197120,2C2E2B28=387A6C55700F197120,000106082C2E2E16=38082C,000106037A700E3A=38082C,000106037A703708=38082C6C550F197120,000106037A701B20=38082C6C550F197120,000106037A70111C=38082C6C550F197120,000106037A703A2D=2C38,000106082733=2C38,000106081015=2C38020F71295283,000106083817=2C2920,7A700F03=2C2920,616D1839=2C292070556C100F,00010608161B=2C2920020F7100010608,302B=2C2920556C0F1971,7A701E07=2C2920010F,1B1B=2C2920010670100F00,352B=2C292000010206100F70,082B=2C292000010206100F707A,0C21=2C292000010870556C100F7A,0617=2C29206C0F1971,7A70552807=2C29207A70556C0F197100010206,122F=2C29207A706C55100F1971,1017=2C29207A706C55100F1971,2731=2C20,616D0436=2C2070550F,7A7D01022E12=2C200F71295283,01021831=2C20556C0F1971,7A702912=2C20100F52,01026D1D33=2C807138152952,000106080E31=2C80713815295270556C100F,000106083201=2C80713815295270556C100F7A,000106080327=2C80713815295202100F,000106037A702B2B=2C80713815295202100F,000106037A702801=2C80713815295202100F,000106083639=2C80713815295202100F7A7055,00010608341D=2C807138152952556C100F,000106037A701B23=2C807138152952010F6C55,7A70302D=2C8071381529520102100F7A7055,2231=2C8071381529520102100F7A6C55,1F13=2C80713815295200010206100F20,7A70313B=2C8071381529526C550F,000106037A701A15=2C8071381529527A70550F,000106080219=2C8071381529527A70556C0F19,000106082E0D=2C80713815295208556C100F,000106037A70161F=2C80711529525670556C100F,000106083813=2C80711529525670556C100F,000106082D05=2C807115295256020F7A706C55,2237=2C80711529525602100F,000106081F0D=2C80711529525602100F55,000106037A702627=2C8071152952560102100F7A706C,2C33=2C8071152952560102100F7A706C,0939=2C80711529525601100F7A7055,416D021F=2C80711529525600010206100F70,0E37=2C80711529525600010870556C10,2129=2C8071152952566C550F,7A702519=2C8071152952566C550F19,7A702417=2C8071152952566C55100F19,000106037A70043B=2C8071152952566C55100F19,000106037A700C1B=2C8071152952566C55100F19,7A703B31=2C8071152952566C100F19,7A705500010603172D=2C8071152952567A70550F,416D3A2F=2C8071152952567A70556C100F,1901=2C8071152952567A706C55100F19,1119=2C8071152952567A6C55700F19,1C2B=2C80711529525608556C100F,000106037A701403=2C80711529525608556C100F,000106037A70071D=2C80711529525608100F55,000106037A701908=292C20,7A7D01026D2E0F=292C200102100F7A7055,032C=292C20000608,0102071C=292C206C550F1971,000106037A700E33=292C207A70556C000108,0503=2920550F,7A702C2E0721=2920556C100F,7A702C1225=2920000108556C100F,7A702C2E1F11=2900010870556C100F7A,032C201A11=297A70556C100F,032C200E35=297A70556C100F,032C20000A=70556C0F197120,7A7D3A29=70556C100F2C20,000106081C25=70556C100F2C20,000106082805=70556C100F2C20,000106082F20=70556C100F2C20,00010608150C=70556C100F29522002,7A7D000106033314=70556C100F,00010608032C20122A=70556C08,7A7D000106032415=70100F2C715220,000106081A0D=4B0F2C20,000106037A701902=4B0F2C20,000106080E3B=4B0F20,7A702C000106032E1
|
|
|
|
|
SHEN_SHA:['无','天恩','母仓','时阳','生气','益后','青龙','灾煞','天火','四忌','八龙','复日','续世','明堂','月煞','月虚','血支','天贼','五虚','土符','归忌','血忌','月德','月恩','四相','王日','天仓','不将','要安','五合','鸣吠对','月建','小时','土府','往亡','天刑','天德','官日','吉期','玉宇','大时','大败','咸池','朱雀','守日','天巫','福德','六仪','金堂','金匮','厌对','招摇','九空','九坎','九焦','相日','宝光','天罡','死神','月刑','月害','游祸','重日','时德','民日','三合','临日','天马','时阴','鸣吠','死气','地囊','白虎','月德合','敬安','玉堂','普护','解神','小耗','天德合','月空','驿马','天后','除神','月破','大耗','五离','天牢','阴德','福生','天吏','致死','元武','阳德','天喜','天医','司命','月厌','地火','四击','大煞','大会','天愿','六合','五富','圣心','河魁','劫煞','四穷','勾陈','触水龙','八风','天赦','五墓','八专','阴错','四耗','阳错','四废','三阴','小会','阴道冲阳','单阴','孤辰','阴位','行狠','了戾','绝阴','纯阳','七鸟','岁薄','阴阳交破','阴阳俱错','阴阳击冲','逐阵','阳错阴冲','七符','天狗','九虎','成日','天符','孤阳','绝阳','纯阴','六蛇','阴神','解除','阳破阴冲'],
|
|
|
|
|
DAY_SHEN_SHA:'100=010203040506,0708090A0B101=010C0D,0E0F101112131415102=16011718191A1B1C1D1E,1F20212223103=24011825261B271D1E,28292A2B104=012C2D2E2F3031,3233343536105=3738,393A3B3C3D123E106=3F404142434445,464748107=494A4B4C4D,4E108=4F5051524C4D5345,54555657109=58595345,5A5B12565C10A=5D415E5F60,616263640B6510B=0266676869,6A6B6C0A3E6D10C=1602171803041B05061E,07086E10D=24181B0C0D,0E0F1011126F13141510E=70191A1C1D,1F2021222310F=0125261B271D,28292A2B110=012C2D2E2F3031,3233343536111=49013738,393A3B3C3D123E112=4F50013F404142434445,4648113=014A4B,4E6E114=51524C4D5345,54550B5657115=0158595345,5A5B12565C116=1601185D415E5F60,61626364117=24021867681B69,6A6B3E6D118=0203040506,0708119=1B0C0D,0E0F10111213141511A=191A1B1C1D1E,1F2021222311B=4925261B271D1E,28292A11C=4F502C2D2E2F3031,323334353611D=3738,393A3B3C3D123E11E=3F404142434445,460B4811F=4A4B,4E71120=16171851524C4D5345,545556121=241858595345,5A5B12565C122=5D415E5F60,61626364123=0267681B69,6A6B3E6D124=0203041B05061E,070847125=491B0C0D,0E0F101112131415126=4F50191A1C1D1E,1F20212223127=2526271D1E,28292A2B128=2C2D2E2F3031,32333435360B129=3738,393A3B3C3D123E12A=1617183F404142434445,464812B=24184A4B,4E7212C=51524C4D53,5455565712D=0158595345,5A5B12565C12E=015D415E5F60,616263647312F=49010267681B69,6A6B3E6D130=4F500102030405061E,070874131=010C0D,0E0F101112131415726E132=191A1C1D1E,1F2021220B722375133=2526271D1E,28292A2B134=1617182C2D2E2F3031,3233343536135=24183738,393A3B3C3D126F3E136=3F4041424344,4648137=4A4B,4E72138=51524C4D5345,545576567257139=4958595345,5A5B7612565C7713A=4F505D415E5F60,6162636413B=02676869,6A6B3E6D200=1601025D60,393B28292A11090A201=0103041A1B4A,123435360B6D202=011819681B4C1D061E,3D1014203=011718252F591D0D1E,1F20213233204=012C26,3C23205=493751522D2E69,121364223E2B206=503F4005311E,6A3A5A5B207=5841440C38,4615208=431C4D45,6B4E5648209=27534B45,545507086162125620A=16666730,0E0F635720B=0241425E5F1B,6C0A0B3E5C20C=02185D1B601E,393B28292A116E20D=171803041B4A,126F3435366D20E=7019684C1D06,3D101420F=4901252F591D0D,1F2021323378210=50012C26,3C23211=013751522D2E69,121364223E2B212=013F40053145,6A3A5A5B213=015841440C38,46156E214=16431C4D5345,6B4E5648215=27534B45,545507086162120B5648216=18671B30,0E0F6357217=02171841425E5F1B,3E5C218=025D60,393B28292A11219=4903041A1B4A,123435366D21A=5019681B4C1D061E,3D101421B=252F591D0D45,1F2021323321C=2C26,3C2321D=3751522D2E69,121364223E2B21E=163F40053145,6A3A5A5B21F=5841440C38,467147150B220=18431C4D5345,6B4E5648221=171827534B45,5455070861621256222=6730,0E0F6357223=490241425E5F1B,3E5C224=50025D1B601E,393B28292A11225=03041A4A,123435366D226=19684C1D061E,3D1014227=252F591D0D1E,1F20213233228=162C26,3C23229=3751522D2E69,121364220B3E2B22A=183F40053145,6A3A5A5B22B=17185841440C38,46157222C=431C4D53,6B4E564822D=490127534B45,54550708616212567922E=5001671B30,0E0F635722F=010241425E5F,3E5C230=01025D601E,393B28292A1174231=0103041A4A,1234353647726E6D232=1619684C1D061E,3D1014233=252F591D0D1E,1F202132330B75234=182C26,3C23235=17183751522D2E69,126F1364223E2B236=3F400531,6A3A5A5B237=495841440C38,461572238=50431C4D5345,6B4E76567248239=27534B45,5455070861627612567323A=6730,0E0F635723B=0241425E5F,3E5C300=0102415E5F1A1B69,090A471457301=011B05,6A125C302=5001185D19515203042F0C1D601E,323315303=4F490118251C1D1E,3C5A5B106D304=012C2706,1F20213B710B787A305=58372668300D,6B123E306=173F402D2E45,07086423307=00,393A0E2B308=24164142444A533145,61624622567B309=674C533845,28292A4E12135630A=431B594D,5455633435364830B=021B27,3D116C0A3E30C=500218415E5F1A1B691E,146E5730D=4F49181B05,6A126F5C30E=705D19515203042F0C1D60,3233150B30F=01251C1D,3C5A5B106D310=01172C2706,1F20213B7C311=0158372668300D,6B123E312=2416013F402D2E45,0708476423313=01,393A0E0F6E2B314=4142444A533145,61624622567D315=66671B4C533845,28292A4E121356316=5018431B594D,54556334353648317=4F4902181B4B,3D113E318=02415E5F1A69,140B57319=1B05,6A125C31A=175D19515203042F0C1D601E,32331531B=251C1D1E,3C5A5B106D31C=24162C2706,1F20213B31D=58372668300D,6B123E31E=3F402D2E45,0708642331F=00,393A0E0F2B320=50184142444A533145,61624622567E321=4F4918671B4C533845,28292A4E121356322=43594D,5455633435360B48323=021B4B,3D113E324=0217415E5F1A691E,1457325=05,6A125C326=581
|
|
|
|
|
getTimeZhiIndex:function(hm){
|
|
|
|
|
if(!hm){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if(hm.length>5){
|
|
|
|
|
hm = hm.substr(0,5);
|
|
|
|
|
}
|
|
|
|
|
var x = 1;
|
|
|
|
|
for(var i=1;i<22;i+=2){
|
|
|
|
|
if(hm>=((i<10?'0':'')+i+':00')&&hm<=((i+1<10?'0':'')+(i+1)+':59')){
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
},
|
|
|
|
|
convertTime:function(hm){
|
|
|
|
|
return this.ZHI[this.getTimeZhiIndex(hm)+1];
|
|
|
|
|
},
|
|
|
|
|
getJiaZiIndex:function(ganZhi){
|
|
|
|
|
for(var i=0,j=this.JIA_ZI.length;i<j;i++){
|
|
|
|
|
if(this.JIA_ZI[i]==ganZhi){
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
},
|
|
|
|
|
hex:function(n){
|
|
|
|
|
var hex = n.toString(16);
|
|
|
|
|
if(hex.length<2){
|
|
|
|
|
hex = '0'+hex;
|
|
|
|
|
}
|
|
|
|
|
return hex.toUpperCase();
|
|
|
|
|
},
|
|
|
|
|
getDayYi:function(monthGanZhi,dayGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var month = this.hex(this.getJiaZiIndex(monthGanZhi));
|
|
|
|
|
var right = this.DAY_YI_JI;
|
|
|
|
|
var index = right.indexOf(day+'=');
|
|
|
|
|
while(index>-1) {
|
|
|
|
|
right = right.substr(index+3);
|
|
|
|
|
var left = right;
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 2);
|
|
|
|
|
}
|
|
|
|
|
var matched = false;
|
|
|
|
|
var months = left.substr(0, left.indexOf(':'));
|
|
|
|
|
var i;
|
|
|
|
|
var m;
|
|
|
|
|
var j;
|
|
|
|
|
for (i = 0, j = months.length; i < j; i += 2) {
|
|
|
|
|
m = months.substr(i, 2);
|
|
|
|
|
if (m==month) {
|
|
|
|
|
matched = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(matched) {
|
|
|
|
|
var ys = left.substr(left.indexOf(':') + 1);
|
|
|
|
|
ys = ys.substr(0, ys.indexOf(','));
|
|
|
|
|
for (i = 0, j = ys.length; i < j; i += 2) {
|
|
|
|
|
m = ys.substr(i, 2);
|
|
|
|
|
l.push(this.YI_JI[parseInt(m,16)]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
index = right.indexOf(day+'=');
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getDayJi:function(monthGanZhi,dayGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var month = this.hex(this.getJiaZiIndex(monthGanZhi));
|
|
|
|
|
var right = this.DAY_YI_JI;
|
|
|
|
|
var index = right.indexOf(day+'=');
|
|
|
|
|
while(index>-1) {
|
|
|
|
|
right = right.substr(index+3);
|
|
|
|
|
var left = right;
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 2);
|
|
|
|
|
}
|
|
|
|
|
var matched = false;
|
|
|
|
|
var months = left.substr(0, left.indexOf(':'));
|
|
|
|
|
var i;
|
|
|
|
|
var m;
|
|
|
|
|
var j;
|
|
|
|
|
for (i = 0, j = months.length; i < j; i += 2) {
|
|
|
|
|
m = months.substr(i, 2);
|
|
|
|
|
if (m==month) {
|
|
|
|
|
matched = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(matched) {
|
|
|
|
|
var js = left.substr(left.indexOf(',')+1);
|
|
|
|
|
for (i = 0, j = js.length; i < j; i += 2) {
|
|
|
|
|
m = js.substr(i, 2);
|
|
|
|
|
l.push(this.YI_JI[parseInt(m,16)]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
index = right.indexOf(day+'=');
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getDayJiShen:function(lunarMonth,dayGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var month = Math.abs(lunarMonth).toString(16).toUpperCase();
|
|
|
|
|
var index = this.DAY_SHEN_SHA.indexOf(month+day+'=');
|
|
|
|
|
if(index>-1) {
|
|
|
|
|
var left = this.DAY_SHEN_SHA.substr(index + 4);
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 3);
|
|
|
|
|
}
|
|
|
|
|
var js = left.substr(0, left.indexOf(','));
|
|
|
|
|
for (var i = 0, j = js.length; i < j; i += 2) {
|
|
|
|
|
var m = js.substr(i, 2);
|
|
|
|
|
l.push(this.SHEN_SHA[parseInt(m, 16)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getDayXiongSha:function(lunarMonth,dayGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var month = Math.abs(lunarMonth).toString(16).toUpperCase();
|
|
|
|
|
var index = this.DAY_SHEN_SHA.indexOf(month+day+'=');
|
|
|
|
|
if(index>-1) {
|
|
|
|
|
var left = this.DAY_SHEN_SHA.substr(index + 4);
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 3);
|
|
|
|
|
}
|
|
|
|
|
var xs = left.substr(left.indexOf(',')+1);
|
|
|
|
|
for (var i = 0, j = xs.length; i < j; i += 2) {
|
|
|
|
|
var m = xs.substr(i, 2);
|
|
|
|
|
l.push(this.SHEN_SHA[parseInt(m, 16)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getTimeYi:function(dayGanZhi,timeGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var time = this.hex(this.getJiaZiIndex(timeGanZhi));
|
|
|
|
|
var index = this.TIME_YI_JI.indexOf(day+time+'=');
|
|
|
|
|
if(index>-1) {
|
|
|
|
|
var left = this.TIME_YI_JI.substr(index + 5);
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 4);
|
|
|
|
|
}
|
|
|
|
|
var ys = left.substr(0, left.indexOf(','));
|
|
|
|
|
for (var i = 0, j = ys.length; i < j; i += 2) {
|
|
|
|
|
var m = ys.substr(i, 2);
|
|
|
|
|
l.push(this.YI_JI[parseInt(m, 16)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getTimeJi:function(dayGanZhi,timeGanZhi){
|
|
|
|
|
var l = [];
|
|
|
|
|
var day = this.hex(this.getJiaZiIndex(dayGanZhi));
|
|
|
|
|
var time = this.hex(this.getJiaZiIndex(timeGanZhi));
|
|
|
|
|
var index = this.TIME_YI_JI.indexOf(day+time+'=');
|
|
|
|
|
if(index>-1) {
|
|
|
|
|
var left = this.TIME_YI_JI.substr(index + 5);
|
|
|
|
|
if (left.indexOf('=')>-1) {
|
|
|
|
|
left = left.substr(0, left.indexOf('=') - 4);
|
|
|
|
|
}
|
|
|
|
|
var js = left.substr(left.indexOf(',')+1);
|
|
|
|
|
for (var i = 0, j = js.length; i < j; i += 2) {
|
|
|
|
|
var m = js.substr(i, 2);
|
|
|
|
|
l.push(this.YI_JI[parseInt(m, 16)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(l.length<1){
|
|
|
|
|
l.push('无');
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getXunIndex:function(ganZhi){
|
|
|
|
|
var gan = ganZhi.substr(0,1);
|
|
|
|
|
var zhi = ganZhi.substr(1);
|
|
|
|
|
var ganIndex = 0;
|
|
|
|
|
var zhiIndex = 0;
|
|
|
|
|
var i;
|
|
|
|
|
var j;
|
|
|
|
|
for(i=0,j=this.GAN.length;i<j;i++){
|
|
|
|
|
if(this.GAN[i]===gan){
|
|
|
|
|
ganIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(i=0,j=this.ZHI.length;i<j;i++){
|
|
|
|
|
if(this.ZHI[i]===zhi){
|
|
|
|
|
zhiIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var diff = ganIndex - zhiIndex;
|
|
|
|
|
if(diff<0){
|
|
|
|
|
diff += 12;
|
|
|
|
|
}
|
|
|
|
|
return diff/2;
|
|
|
|
|
},
|
|
|
|
|
getXun:function(ganZhi){
|
|
|
|
|
return this.XUN[this.getXunIndex(ganZhi)];
|
|
|
|
|
},
|
|
|
|
|
getXunKong:function(ganZhi){
|
|
|
|
|
return this.XUN_KONG[this.getXunIndex(ganZhi)];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var HolidayUtil = (function(_NAMES){
|
|
|
|
|
var _SIZE = 18;
|
|
|
|
|
var _ZERO='0'.charCodeAt(0);
|
|
|
|
|
var _NAMES_IN_USE=_NAMES,_DATA='200112290020020101200112300020020101200201010120020101200201020120020101200201030120020101200202091020020212200202101020020212200202121120020212200202131120020212200202141120020212200202151120020212200202161120020212200202171120020212200202181120020212200204273020020501200204283020020501200205013120020501200205023120020501200205033120020501200205043120020501200205053120020501200205063120020501200205073120021001200209286020021001200209296020021001200210016120021001200210026120021001200210036120021001200210046120021001200210056120021001200210066120021001200210076120021001200301010120030101200302011120030201200302021120030201200302031120030201200302041120030201200302051120030201200302061120030201200302071120030201200302081020030201200302091020030201200304263020030501200304273020030501200305013120030501200305023120030501200305033120030501200305043120030501200305053120030501200305063120030501200305073120031001200309276020031001200309286020031001200310016120031001200310026120031001200310036120031001200310046120031001200310056120031001200310066120031001200310076120031001200401010120040101200401171020040122200401181020040122200401221120040122200401231120040122200401241120040122200401251120040122200401261120040122200401271120040122200401281120040122200405013120040501200405023120040501200405033120040501200405043120040501200405053120040501200405063120040501200405073120041001200405083020040501200405093020040501200410016120041001200410026120041001200410036120041001200410046120041001200410056120041001200410066120041001200410076120041001200410096020041001200410106020041001200501010120050101200501020120050101200501030120050101200502051020050209200502061020050209200502091120050209200502101120050209200502111120050209200502121120050209200502131120050209200502141120050209200502151120050209200504303020050501200505013120050501200505023120050501200505033120050501200505043120050501200505053120050501200505063120050501200505073120051001200505083020050501200510016120051001200510026120051001200510036120051001200510046120051001200510056120051001200510066120051001200510076120051001200510086020051001200510096020051001200512310020060101200601010120060101200601020120060101200601030120060101200601281020060129200601291120060129200601301120060129200601311120060129200602011120060129200602021120060129200602031120060129200602041120060129200602051020060129200604293020060501200604303020060501200605013120060501200605023120060501200605033120060501200605043120060501200605053120060501200605063120060501200605073120061001200609306020061001200610016120061001200610026120061001200610036120061001200610046120061001200610056120061001200610066120061001200610076120061001200610086020061001200612300020070101200612310020070101200701010120070101200701020120070101200701030120070101200702171020070218200702181120070218200702191120070218200702201120070218200702211120070218200702221120070218200702231120070218200702241120070218200702251020070218200704283020070501200704293020070501200705013120070501200705023120070501200705033120070501200705043120070501200705053120070501200705063120070501200705073120070501200709296020071001200709306020071001200710016120071001200710026120071001200710036120071001200710046120071001200710056120071001200710066120071001200710076120071001200712290020080101200712300120080101200712310120080101200801010120080101200802021020080206200802031020080206200802061120080206200802071120080206200802081120080206200802091120080206200802101120080206200802111120080206200802121120080206200804042120080404200804052120080404200804062120080404200805013120080501200805023120080501200805033120080501200805043020080501200806074120080608200806084120080608200806094120080608200809135120080914200809145120080914200809155120080914200809276020081001200809286020081001200809296120081001200809306120081001200810016120081001200810026120081001200810036120081001200810046120081001200810056120081001200901010120090101200901020120090101200901030120090101200901040020090101200901241020090125200901251120090125200901261120090125200901271120090125200901281120090125200901291
|
|
|
|
|
var _DATA_IN_USE = _DATA;
|
|
|
|
|
var _padding = function(n){
|
|
|
|
|
return (n<10?'0':'')+n;
|
|
|
|
|
};
|
|
|
|
|
var _ymd = function(s){
|
|
|
|
|
return s.indexOf('-')<0?(s.substr(0,4)+'-'+s.substr(4,2)+'-'+s.substr(6)):s;
|
|
|
|
|
};
|
|
|
|
|
var _buildHoliday = function(day,name,work,target){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
day:_ymd(day),
|
|
|
|
|
name:name,
|
|
|
|
|
work:work,
|
|
|
|
|
target:_ymd(target)
|
|
|
|
|
},
|
|
|
|
|
getDay:function(){
|
|
|
|
|
return this._p.day;
|
|
|
|
|
},
|
|
|
|
|
setDay:function(v){
|
|
|
|
|
this._p.day = _ymd(v);
|
|
|
|
|
},
|
|
|
|
|
getName:function(){
|
|
|
|
|
return this._p.name;
|
|
|
|
|
},
|
|
|
|
|
setName:function(v){
|
|
|
|
|
this._p.name = v;
|
|
|
|
|
},
|
|
|
|
|
isWork:function(){
|
|
|
|
|
return this._p.work;
|
|
|
|
|
},
|
|
|
|
|
setWork:function(v){
|
|
|
|
|
this._p.work = v;
|
|
|
|
|
},
|
|
|
|
|
getTarget:function(){
|
|
|
|
|
return this._p.target;
|
|
|
|
|
},
|
|
|
|
|
setTarget:function(v){
|
|
|
|
|
this._p.target = _ymd(v);
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this._p.day+' '+this._p.name+(this._p.work?'调休':'')+' '+this._p.target;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var _buildHolidayForward = function(s){
|
|
|
|
|
var day = s.substr(0,8);
|
|
|
|
|
var name = _NAMES_IN_USE[s.charCodeAt(8)-_ZERO];
|
|
|
|
|
var work = s.charCodeAt(9)===_ZERO;
|
|
|
|
|
var target = s.substr(10,8);
|
|
|
|
|
return _buildHoliday(day,name,work,target);
|
|
|
|
|
};
|
|
|
|
|
var _buildHolidayBackward = function(s){
|
|
|
|
|
var size = s.length;
|
|
|
|
|
var day = s.substr(size-18,8);
|
|
|
|
|
var name = _NAMES_IN_USE[s.charCodeAt(size-10)-_ZERO];
|
|
|
|
|
var work = s.charCodeAt(size-9)===_ZERO;
|
|
|
|
|
var target = s.substr(size-8);
|
|
|
|
|
return _buildHoliday(day,name,work,target);
|
|
|
|
|
};
|
|
|
|
|
var _findForward = function(key){
|
|
|
|
|
var start = _DATA_IN_USE.indexOf(key);
|
|
|
|
|
if(start<0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
var right = _DATA_IN_USE.substr(start);
|
|
|
|
|
var n = right.length%_SIZE;
|
|
|
|
|
if(n>0){
|
|
|
|
|
right = right.substr(n);
|
|
|
|
|
}
|
|
|
|
|
while((0!==right.indexOf(key))&&right.length>=_SIZE){
|
|
|
|
|
right = right.substr(_SIZE);
|
|
|
|
|
}
|
|
|
|
|
return right;
|
|
|
|
|
};
|
|
|
|
|
var _findBackward = function(key){
|
|
|
|
|
var start = _DATA_IN_USE.lastIndexOf(key);
|
|
|
|
|
if(start<0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
var keySize = key.length;
|
|
|
|
|
var left = _DATA_IN_USE.substr(0,start+keySize);
|
|
|
|
|
var size = left.length;
|
|
|
|
|
var n = size%_SIZE;
|
|
|
|
|
if(n>0){
|
|
|
|
|
left = left.substr(0,size-n);
|
|
|
|
|
}
|
|
|
|
|
size = left.length;
|
|
|
|
|
while((size-keySize!==left.lastIndexOf(key))&&size>=_SIZE){
|
|
|
|
|
left = left.substr(0,size-_SIZE);
|
|
|
|
|
size = left.length;
|
|
|
|
|
}
|
|
|
|
|
return left;
|
|
|
|
|
};
|
|
|
|
|
var _findHolidaysForward = function(key){
|
|
|
|
|
var l = [];
|
|
|
|
|
var s = _findForward(key);
|
|
|
|
|
if(null==s) {
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
while(0===s.indexOf(key)){
|
|
|
|
|
l.push(_buildHolidayForward(s));
|
|
|
|
|
s = s.substr(_SIZE);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
};
|
|
|
|
|
var _findHolidaysBackward = function(key){
|
|
|
|
|
var l = [];
|
|
|
|
|
var s = _findBackward(key);
|
|
|
|
|
if(null==s) {
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
var size = s.length;
|
|
|
|
|
var keySize = key.length;
|
|
|
|
|
while(size-keySize===s.lastIndexOf(key)){
|
|
|
|
|
l.push(_buildHolidayBackward(s));
|
|
|
|
|
s = s.substr(0,size-_SIZE);
|
|
|
|
|
size = s.length;
|
|
|
|
|
}
|
|
|
|
|
l.reverse();
|
|
|
|
|
return l;
|
|
|
|
|
};
|
|
|
|
|
var _getHoliday = function(args){
|
|
|
|
|
var l = [];
|
|
|
|
|
switch(args.length){
|
|
|
|
|
case 1:
|
|
|
|
|
l = _findHolidaysForward(args[0].replace(/-/g,''));
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
l = _findHolidaysForward(args[0]+_padding(args[1])+_padding(args[2]));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return l.length<1?null:l[0];
|
|
|
|
|
};
|
|
|
|
|
var _getHolidays = function(args){
|
|
|
|
|
var l = [];
|
|
|
|
|
switch(args.length){
|
|
|
|
|
case 1:
|
|
|
|
|
l = _findHolidaysForward((args[0]+'').replace(/-/g,''));
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
l = _findHolidaysForward(args[0]+_padding(args[1]));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
};
|
|
|
|
|
var _getHolidaysByTarget = function(args){
|
|
|
|
|
var l = [];
|
|
|
|
|
switch(args.length){
|
|
|
|
|
case 1:
|
|
|
|
|
l = _findHolidaysBackward((args[0]+'').replace(/-/g,''));
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
l = _findHolidaysBackward(args[0]+_padding(args[1])+_padding(args[2]));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
};
|
|
|
|
|
var _fixNames = function(names){
|
|
|
|
|
if(names){
|
|
|
|
|
_NAMES_IN_USE = names;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var _fixData = function(data){
|
|
|
|
|
if(!data){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var append = [];
|
|
|
|
|
while(data.length>=_SIZE){
|
|
|
|
|
var segment = data.substr(0,_SIZE);
|
|
|
|
|
var day = segment.substr(0,8);
|
|
|
|
|
var holiday = _getHoliday([day]);
|
|
|
|
|
if(!holiday){
|
|
|
|
|
append.push(segment);
|
|
|
|
|
}else{
|
|
|
|
|
var nameIndex = -1;
|
|
|
|
|
for(var i=0,j=_NAMES_IN_USE.length;i<j;i++){
|
|
|
|
|
if(_NAMES_IN_USE[i]===holiday.getName()){
|
|
|
|
|
nameIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(nameIndex>-1){
|
|
|
|
|
var old = day+String.fromCharCode(nameIndex+_ZERO)+(holiday.isWork()?'0':'1')+holiday.getTarget().replace(/-/g,'');
|
|
|
|
|
_DATA_IN_USE = _DATA_IN_USE.replace(new RegExp(old, 'g'), segment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
data = data.substr(_SIZE);
|
|
|
|
|
}
|
|
|
|
|
if(append.length>0){
|
|
|
|
|
_DATA_IN_USE += append.join('');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var _fix = function(args){
|
|
|
|
|
switch(args.length){
|
|
|
|
|
case 1:
|
|
|
|
|
_fixData(args[0]);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
_fixNames(args[0]);
|
|
|
|
|
_fixData(args[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
NAMES:_NAMES,
|
|
|
|
|
getHoliday:function(){return _getHoliday(arguments);},
|
|
|
|
|
getHolidays:function(){return _getHolidays(arguments);},
|
|
|
|
|
getHolidaysByTarget:function(){return _getHolidaysByTarget(arguments);},
|
|
|
|
|
fix:function(){_fix(arguments);}
|
|
|
|
|
};
|
|
|
|
|
})(['元旦节','春节','清明节','劳动节','端午节','中秋节','国庆节','国庆中秋','抗战胜利日']);
|
|
|
|
|
var NineStar = (function(){
|
|
|
|
|
var _fromIndex=function(index){
|
|
|
|
|
return {
|
|
|
|
|
_p:{index:index},
|
|
|
|
|
getNumber:function(){return NineStar.NUMBER[this._p.index];},
|
|
|
|
|
getColor:function(){return NineStar.COLOR[this._p.index];},
|
|
|
|
|
getWuXing:function(){return NineStar.WU_XING[this._p.index];},
|
|
|
|
|
getPosition:function(){return NineStar.POSITION[this._p.index];},
|
|
|
|
|
getPositionDesc:function(){return LunarUtil.POSITION_DESC[this.getPosition()];},
|
|
|
|
|
getNameInXuanKong:function(){return NineStar.NAME_XUAN_KONG[this._p.index];},
|
|
|
|
|
getNameInBeiDou:function(){return NineStar.NAME_BEI_DOU[this._p.index];},
|
|
|
|
|
getNameInQiMen:function(){return NineStar.NAME_QI_MEN[this._p.index];},
|
|
|
|
|
getNameInTaiYi:function(){return NineStar.NAME_TAI_YI[this._p.index];},
|
|
|
|
|
getLuckInQiMen:function(){return NineStar.LUCK_QI_MEN[this._p.index];},
|
|
|
|
|
getLuckInXuanKong:function(){return NineStar.LUCK_XUAN_KONG[this._p.index];},
|
|
|
|
|
getYinYangInQiMen:function(){return NineStar.YIN_YANG_QI_MEN[this._p.index];},
|
|
|
|
|
getTypeInTaiYi:function(){return NineStar.TYPE_TAI_YI[this._p.index];},
|
|
|
|
|
getBaMenInQiMen:function(){return NineStar.BA_MEN_QI_MEN[this._p.index];},
|
|
|
|
|
getSongInTaiYi:function(){return NineStar.SONG_TAI_YI[this._p.index];},
|
|
|
|
|
getIndex:function(){return this._p.index;},
|
|
|
|
|
toString:function(){return this.getNumber()+this.getColor()+this.getWuXing()+this.getNameInBeiDou();},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var s = this.getNumber();
|
|
|
|
|
s += this.getColor();
|
|
|
|
|
s += this.getWuXing();
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getPosition();
|
|
|
|
|
s += '(';
|
|
|
|
|
s += this.getPositionDesc();
|
|
|
|
|
s += ') ';
|
|
|
|
|
s += this.getNameInBeiDou();
|
|
|
|
|
s += ' 玄空[';
|
|
|
|
|
s += this.getNameInXuanKong();
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getLuckInXuanKong();
|
|
|
|
|
s += '] 奇门[';
|
|
|
|
|
s += this.getNameInQiMen();
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getLuckInQiMen();
|
|
|
|
|
if(this.getBaMenInQiMen().length>0) {
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getBaMenInQiMen();
|
|
|
|
|
s += '门';
|
|
|
|
|
}
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getYinYangInQiMen();
|
|
|
|
|
s += '] 太乙[';
|
|
|
|
|
s += this.getNameInTaiYi();
|
|
|
|
|
s += ' ';
|
|
|
|
|
s += this.getTypeInTaiYi();
|
|
|
|
|
s += ']';
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
NUMBER:['一','二','三','四','五','六','七','八','九'],
|
|
|
|
|
COLOR:['白','黒','碧','绿','黄','白','赤','白','紫'],
|
|
|
|
|
WU_XING:['水','土','木','木','土','金','金','土','火'],
|
|
|
|
|
POSITION:['坎','坤','震','巽','中','乾','兑','艮','离'],
|
|
|
|
|
NAME_BEI_DOU:['天枢','天璇','天玑','天权','玉衡','开阳','摇光','洞明','隐元'],
|
|
|
|
|
NAME_XUAN_KONG:['贪狼','巨门','禄存','文曲','廉贞','武曲','破军','左辅','右弼'],
|
|
|
|
|
NAME_QI_MEN:['天蓬','天芮','天冲','天辅','天禽','天心','天柱','天任','天英'],
|
|
|
|
|
BA_MEN_QI_MEN:['休','死','伤','杜','','开','惊','生','景'],
|
|
|
|
|
NAME_TAI_YI:['太乙','摄提','轩辕','招摇','天符','青龙','咸池','太阴','天乙'],
|
|
|
|
|
TYPE_TAI_YI:['吉神','凶神','安神','安神','凶神','吉神','凶神','吉神','吉神'],
|
|
|
|
|
SONG_TAI_YI:['门中太乙明,星官号贪狼,赌彩财喜旺,婚姻大吉昌,出入无阻挡,参谒见贤良,此行三五里,黑衣别阴阳。','门前见摄提,百事必忧疑,相生犹自可,相克祸必临,死门并相会,老妇哭悲啼,求谋并吉事,尽皆不相宜,只可藏隐遁,若动伤身疾。','出入会轩辕,凡事必缠牵,相生全不美,相克更忧煎,远行多不利,博彩尽输钱,九天玄女法,句句不虚言。','招摇号木星,当之事莫行,相克行人阻,阴人口舌迎,梦寐多惊惧,屋响斧自鸣,阴阳消息理,万法弗违情。','五鬼为天符,当门阴女谋,相克无好事,行路阻中途,走失难寻觅,道逢有尼姑,此星当门值,万事有灾除。','神光跃青龙,财气喜重重,投入有酒食,赌彩最兴隆,更逢相生旺,休言克破凶,见贵安营寨,万事总吉同。','吾将为咸池,当之尽不宜,出入多不利,相克有灾情,赌彩全输尽,求财空手回,仙人真妙语,愚人莫与知,动用虚惊退,反复逆风吹。','坐临太阴星,百祸不相侵,求谋悉成就,知交有觅寻,回风归来路,恐有殃伏起,密语中记取,慎乎莫轻行。','迎来天乙星,相逢百事兴,运用和合庆,茶酒喜相迎,求谋并嫁娶,好合有天成,祸福如神验,吉凶甚分明。'],
|
|
|
|
|
LUCK_XUAN_KONG:['吉','凶','凶','吉','凶','吉','凶','吉','吉'],
|
|
|
|
|
LUCK_QI_MEN:['大凶','大凶','小吉','大吉','大吉','大吉','小凶','小吉','小凶'],
|
|
|
|
|
YIN_YANG_QI_MEN:['阳','阴','阳','阳','阳','阴','阴','阳','阴'],
|
|
|
|
|
fromIndex:function(index){return _fromIndex(index);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var EightChar = (function(){
|
|
|
|
|
var CHANG_SHENG_OFFSET = {'甲':1,'丙':10,'戊':10,'庚':7,'壬':4,'乙':6,'丁':9,'己':9,'辛':0,'癸':3};
|
|
|
|
|
var _fromLunar=function(lunar){
|
|
|
|
|
return {
|
|
|
|
|
_p:{sect:2,lunar:lunar},
|
|
|
|
|
setSect:function(sect){this._p.sect=(1==sect)?1:2;},
|
|
|
|
|
getSect:function(){return this._p.sect;},
|
|
|
|
|
getDayGanIndex:function(){return 2==this._p.sect?this._p.lunar.getDayGanIndexExact2():this._p.lunar.getDayGanIndexExact();},
|
|
|
|
|
getDayZhiIndex:function(){return 2==this._p.sect?this._p.lunar.getDayZhiIndexExact2():this._p.lunar.getDayZhiIndexExact();},
|
|
|
|
|
getYear:function(){return this._p.lunar.getYearInGanZhiExact();},
|
|
|
|
|
getYearGan:function(){return this._p.lunar.getYearGanExact();},
|
|
|
|
|
getYearZhi:function(){return this._p.lunar.getYearZhiExact();},
|
|
|
|
|
getYearHideGan:function(){return LunarUtil.ZHI_HIDE_GAN[this.getYearZhi()];},
|
|
|
|
|
getYearWuXing:function(){return LunarUtil.WU_XING_GAN[this.getYearGan()]+LunarUtil.WU_XING_ZHI[this.getYearZhi()];},
|
|
|
|
|
getYearNaYin:function(){return LunarUtil.NAYIN[this.getYear()];},
|
|
|
|
|
getYearShiShenGan:function(){return LunarUtil.SHI_SHEN_GAN[this.getDayGan()+this.getYearGan()];},
|
|
|
|
|
getYearShiShenZhi:function(){
|
|
|
|
|
var dayGan = this.getDayGan();
|
|
|
|
|
var zhi = this.getYearZhi();
|
|
|
|
|
var hideGan = LunarUtil.ZHI_HIDE_GAN[zhi];
|
|
|
|
|
var l = [];
|
|
|
|
|
for(var i=0,j=hideGan.length;i<j;i++){
|
|
|
|
|
l.push(LunarUtil.SHI_SHEN_ZHI[dayGan+zhi+hideGan[i]]);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
_getDiShi:function(zhiIndex){
|
|
|
|
|
var offset = CHANG_SHENG_OFFSET[this.getDayGan()];
|
|
|
|
|
var index = offset + (this.getDayGanIndex()%2==0?zhiIndex:-zhiIndex);
|
|
|
|
|
if(index>=12){
|
|
|
|
|
index -= 12;
|
|
|
|
|
}
|
|
|
|
|
if(index<0){
|
|
|
|
|
index += 12;
|
|
|
|
|
}
|
|
|
|
|
return EightChar.CHANG_SHENG[index];
|
|
|
|
|
},
|
|
|
|
|
getYearDiShi:function(){return this._getDiShi(this._p.lunar.getYearZhiIndexExact());},
|
|
|
|
|
getYearXun:function(){return this._p.lunar.getYearXunExact()},
|
|
|
|
|
getYearXunKong:function(){return this._p.lunar.getYearXunKongExact()},
|
|
|
|
|
getMonth:function(){return this._p.lunar.getMonthInGanZhiExact();},
|
|
|
|
|
getMonthGan:function(){return this._p.lunar.getMonthGanExact();},
|
|
|
|
|
getMonthZhi:function(){return this._p.lunar.getMonthZhiExact();},
|
|
|
|
|
getMonthHideGan:function(){return LunarUtil.ZHI_HIDE_GAN[this.getMonthZhi()];},
|
|
|
|
|
getMonthWuXing:function(){return LunarUtil.WU_XING_GAN[this.getMonthGan()]+LunarUtil.WU_XING_ZHI[this.getMonthZhi()];},
|
|
|
|
|
getMonthNaYin:function(){return LunarUtil.NAYIN[this.getMonth()];},
|
|
|
|
|
getMonthShiShenGan:function(){return LunarUtil.SHI_SHEN_GAN[this.getDayGan()+this.getMonthGan()];},
|
|
|
|
|
getMonthShiShenZhi:function(){
|
|
|
|
|
var dayGan = this.getDayGan();
|
|
|
|
|
var zhi = this.getMonthZhi();
|
|
|
|
|
var hideGan = LunarUtil.ZHI_HIDE_GAN[zhi];
|
|
|
|
|
var l = [];
|
|
|
|
|
for(var i=0,j=hideGan.length;i<j;i++){
|
|
|
|
|
l.push(LunarUtil.SHI_SHEN_ZHI[dayGan+zhi+hideGan[i]]);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getMonthDiShi:function(){return this._getDiShi(this._p.lunar.getMonthZhiIndexExact());},
|
|
|
|
|
getMonthXun:function(){return this._p.lunar.getMonthXunExact()},
|
|
|
|
|
getMonthXunKong:function(){return this._p.lunar.getMonthXunKongExact()},
|
|
|
|
|
getDay:function(){return 2==this._p.sect?this._p.lunar.getDayInGanZhiExact2():this._p.lunar.getDayInGanZhiExact();},
|
|
|
|
|
getDayGan:function(){return 2==this._p.sect?this._p.lunar.getDayGanExact2():this._p.lunar.getDayGanExact();},
|
|
|
|
|
getDayZhi:function(){return 2==this._p.sect?this._p.lunar.getDayZhiExact2():this._p.lunar.getDayZhiExact();},
|
|
|
|
|
getDayHideGan:function(){return LunarUtil.ZHI_HIDE_GAN[this.getDayZhi()];},
|
|
|
|
|
getDayWuXing:function(){return LunarUtil.WU_XING_GAN[this.getDayGan()]+LunarUtil.WU_XING_ZHI[this.getDayZhi()];},
|
|
|
|
|
getDayNaYin:function(){return LunarUtil.NAYIN[this.getDay()];},
|
|
|
|
|
getDayShiShenGan:function(){return '日主';},
|
|
|
|
|
getDayShiShenZhi:function(){
|
|
|
|
|
var dayGan = this.getDayGan();
|
|
|
|
|
var zhi = this.getDayZhi();
|
|
|
|
|
var hideGan = LunarUtil.ZHI_HIDE_GAN[zhi];
|
|
|
|
|
var l = [];
|
|
|
|
|
for(var i=0,j=hideGan.length;i<j;i++){
|
|
|
|
|
l.push(LunarUtil.SHI_SHEN_ZHI[dayGan+zhi+hideGan[i]]);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getDayDiShi:function(){return this._getDiShi(this.getDayZhiIndex());},
|
|
|
|
|
getDayXun:function(){return 2==this._p.sect?this._p.lunar.getDayXunExact2():this._p.lunar.getDayXunExact()},
|
|
|
|
|
getDayXunKong:function(){return 2==this._p.sect?this._p.lunar.getDayXunKongExact2():this._p.lunar.getDayXunKongExact()},
|
|
|
|
|
getTime:function(){return this._p.lunar.getTimeInGanZhi();},
|
|
|
|
|
getTimeGan:function(){return this._p.lunar.getTimeGan();},
|
|
|
|
|
getTimeZhi:function(){return this._p.lunar.getTimeZhi();},
|
|
|
|
|
getTimeHideGan:function(){return LunarUtil.ZHI_HIDE_GAN[this.getTimeZhi()];},
|
|
|
|
|
getTimeWuXing:function(){return LunarUtil.WU_XING_GAN[this.getTimeGan()]+LunarUtil.WU_XING_ZHI[this.getTimeZhi()];},
|
|
|
|
|
getTimeNaYin:function(){return LunarUtil.NAYIN[this.getTime()];},
|
|
|
|
|
getTimeShiShenGan:function(){return LunarUtil.SHI_SHEN_GAN[this.getDayGan()+this.getTimeGan()];},
|
|
|
|
|
getTimeShiShenZhi:function(){
|
|
|
|
|
var dayGan = this.getDayGan();
|
|
|
|
|
var zhi = this.getTimeZhi();
|
|
|
|
|
var hideGan = LunarUtil.ZHI_HIDE_GAN[zhi];
|
|
|
|
|
var l = [];
|
|
|
|
|
for(var i=0,j=hideGan.length;i<j;i++){
|
|
|
|
|
l.push(LunarUtil.SHI_SHEN_ZHI[dayGan+zhi+hideGan[i]]);
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getTimeDiShi:function(){return this._getDiShi(this._p.lunar.getTimeZhiIndex());},
|
|
|
|
|
getTimeXun:function(){return this._p.lunar.getTimeXun();},
|
|
|
|
|
getTimeXunKong:function(){return this._p.lunar.getTimeXunKong();},
|
|
|
|
|
getTaiYuan:function(){
|
|
|
|
|
var ganIndex = this._p.lunar.getMonthGanIndexExact() + 1;
|
|
|
|
|
if(ganIndex>=10){
|
|
|
|
|
ganIndex -= 10;
|
|
|
|
|
}
|
|
|
|
|
var zhiIndex = this._p.lunar.getMonthZhiIndexExact() + 3;
|
|
|
|
|
if(zhiIndex>=12){
|
|
|
|
|
zhiIndex -= 12;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.GAN[ganIndex+1]+LunarUtil.ZHI[zhiIndex+1];
|
|
|
|
|
},
|
|
|
|
|
getTaiYuanNaYin:function(){return LunarUtil.NAYIN[this.getTaiYuan()];},
|
|
|
|
|
getMingGong:function(){
|
|
|
|
|
var monthZhiIndex = 0;
|
|
|
|
|
var timeZhiIndex = 0;
|
|
|
|
|
for(var i=0,j=EightChar.MONTH_ZHI.length;i<j;i++){
|
|
|
|
|
var zhi = EightChar.MONTH_ZHI[i];
|
|
|
|
|
if(lunar.getMonthZhiExact()===zhi){
|
|
|
|
|
monthZhiIndex = i;
|
|
|
|
|
}
|
|
|
|
|
if(lunar.getTimeZhi()===zhi){
|
|
|
|
|
timeZhiIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var zhiIndex = 26 - (monthZhiIndex+timeZhiIndex);
|
|
|
|
|
if(zhiIndex>12){
|
|
|
|
|
zhiIndex -= 12;
|
|
|
|
|
}
|
|
|
|
|
var jiaZiIndex = LunarUtil.getJiaZiIndex(lunar.getMonthInGanZhiExact()) - (monthZhiIndex-zhiIndex);
|
|
|
|
|
if(jiaZiIndex>=60){
|
|
|
|
|
jiaZiIndex -= 60;
|
|
|
|
|
}
|
|
|
|
|
if(jiaZiIndex<0){
|
|
|
|
|
jiaZiIndex += 60;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.JIA_ZI[jiaZiIndex];
|
|
|
|
|
},
|
|
|
|
|
getMingGongNaYin:function(){return LunarUtil.NAYIN[this.getMingGong()];},
|
|
|
|
|
getShenGong:function(){
|
|
|
|
|
var monthZhiIndex = 0;
|
|
|
|
|
var timeZhiIndex = 0;
|
|
|
|
|
for(var i=0,j=EightChar.MONTH_ZHI.length;i<j;i++){
|
|
|
|
|
var zhi = EightChar.MONTH_ZHI[i];
|
|
|
|
|
if(lunar.getMonthZhiExact()===zhi){
|
|
|
|
|
monthZhiIndex = i;
|
|
|
|
|
}
|
|
|
|
|
if(lunar.getTimeZhi()===zhi){
|
|
|
|
|
timeZhiIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var zhiIndex = (2 + (monthZhiIndex+timeZhiIndex))%12;
|
|
|
|
|
var jiaZiIndex = LunarUtil.getJiaZiIndex(lunar.getMonthInGanZhiExact()) - (monthZhiIndex-zhiIndex);
|
|
|
|
|
if(jiaZiIndex>=60){
|
|
|
|
|
jiaZiIndex -= 60;
|
|
|
|
|
}
|
|
|
|
|
if(jiaZiIndex<0){
|
|
|
|
|
jiaZiIndex += 60;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.JIA_ZI[jiaZiIndex];
|
|
|
|
|
},
|
|
|
|
|
getShenGongNaYin:function(){return LunarUtil.NAYIN[this.getShenGong()];},
|
|
|
|
|
getLunar:function(){return this._p.lunar;},
|
|
|
|
|
getYun:function(gender){
|
|
|
|
|
var lunar = this.getLunar();
|
|
|
|
|
var yang = 0 === lunar.getYearGanIndexExact() % 2;
|
|
|
|
|
var man = 1 === gender;
|
|
|
|
|
var forward = (yang && man) || (!yang && !man);
|
|
|
|
|
var start = (function(){
|
|
|
|
|
var prev = lunar.getPrevJie();
|
|
|
|
|
var next = lunar.getNextJie();
|
|
|
|
|
var current = lunar.getSolar();
|
|
|
|
|
var start = forward ? current : prev.getSolar();
|
|
|
|
|
var end = forward ? next.getSolar() : current;
|
|
|
|
|
const endTimeZhiIndex = (end.getHour() === 23) ? 11 : LunarUtil.getTimeZhiIndex(end.toYmdHms().substr(11, 5));
|
|
|
|
|
const startTimeZhiIndex = (start.getHour() === 23) ? 11 : LunarUtil.getTimeZhiIndex(start.toYmdHms().substr(11, 5));
|
|
|
|
|
// 时辰差
|
|
|
|
|
var hourDiff = endTimeZhiIndex - startTimeZhiIndex;
|
|
|
|
|
// 天数差
|
|
|
|
|
var dayDiff = ExactDate.getDaysBetweenYmd(start.getYear(), start.getMonth(), start.getDay(), end.getYear(), end.getMonth(), end.getDay());
|
|
|
|
|
if (hourDiff < 0) {
|
|
|
|
|
hourDiff += 12;
|
|
|
|
|
dayDiff--;
|
|
|
|
|
}
|
|
|
|
|
var monthDiff = Math.floor(hourDiff * 10 / 30);
|
|
|
|
|
var month = dayDiff * 4 + monthDiff;
|
|
|
|
|
var day = hourDiff * 10 - monthDiff * 30;
|
|
|
|
|
var year = Math.floor(month / 12);
|
|
|
|
|
month = month - year * 12;
|
|
|
|
|
return {
|
|
|
|
|
year: year,
|
|
|
|
|
month: month,
|
|
|
|
|
day: day
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var buildLiuYue = function(liuNian, index){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
index: index,
|
|
|
|
|
liuNian: liuNian
|
|
|
|
|
},
|
|
|
|
|
getIndex:function(){return this._p.index;},
|
|
|
|
|
getMonthInChinese:function(){return LunarUtil.MONTH[this._p.index + 1];},
|
|
|
|
|
getGanZhi:function(){
|
|
|
|
|
var offset = 0;
|
|
|
|
|
var yearGan = liuNian.getGanZhi().substr(0, 1);
|
|
|
|
|
if ('甲'===yearGan || '己'===yearGan) {
|
|
|
|
|
offset = 2;
|
|
|
|
|
} else if ('乙'===yearGan || '庚'===yearGan) {
|
|
|
|
|
offset = 4;
|
|
|
|
|
} else if ('丙'===yearGan || '辛'===yearGan) {
|
|
|
|
|
offset = 6;
|
|
|
|
|
} else if ('丁'===yearGan || '壬'===yearGan) {
|
|
|
|
|
offset = 8;
|
|
|
|
|
}
|
|
|
|
|
var gan = LunarUtil.GAN[(this._p.index + offset) % 10 + 1];
|
|
|
|
|
var zhi = LunarUtil.ZHI[(this._p.index + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12 + 1];
|
|
|
|
|
return gan + zhi;
|
|
|
|
|
},
|
|
|
|
|
getXun:function(){return LunarUtil.getXun(this.getGanZhi());},
|
|
|
|
|
getXunKong:function(){return LunarUtil.getXunKong(this.getGanZhi());}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var buildLiuNian = function(daYun, index){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
year: daYun.getStartYear() + index,
|
|
|
|
|
age: daYun.getStartAge() + index,
|
|
|
|
|
index: index,
|
|
|
|
|
daYun: daYun,
|
|
|
|
|
lunar: daYun.getLunar()
|
|
|
|
|
},
|
|
|
|
|
getYear: function(){return this._p.year;},
|
|
|
|
|
getAge: function(){return this._p.age;},
|
|
|
|
|
getIndex: function(){return this._p.index;},
|
|
|
|
|
getLunar: function(){return this._p.lunar;},
|
|
|
|
|
getGanZhi: function(){
|
|
|
|
|
var offset = LunarUtil.getJiaZiIndex(this._p.lunar.getJieQiTable()['立春'].getLunar().getYearInGanZhiExact()) + this._p.index;
|
|
|
|
|
if (this._p.daYun.getIndex() > 0) {
|
|
|
|
|
offset += this._p.daYun.getStartAge() - 1;
|
|
|
|
|
}
|
|
|
|
|
offset %= LunarUtil.JIA_ZI.length;
|
|
|
|
|
return LunarUtil.JIA_ZI[offset];
|
|
|
|
|
},
|
|
|
|
|
getXun:function(){return LunarUtil.getXun(this.getGanZhi());},
|
|
|
|
|
getXunKong:function(){return LunarUtil.getXunKong(this.getGanZhi());},
|
|
|
|
|
getLiuYue: function(){
|
|
|
|
|
var l = [];
|
|
|
|
|
for (var i = 0; i < 12; i++) {
|
|
|
|
|
l.push(buildLiuYue(this,i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var buildXiaoYun = function(daYun, index, forward){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
year: daYun.getStartYear() + index,
|
|
|
|
|
age: daYun.getStartAge() + index,
|
|
|
|
|
index: index,
|
|
|
|
|
daYun: daYun,
|
|
|
|
|
forward: forward,
|
|
|
|
|
lunar: daYun.getLunar()
|
|
|
|
|
},
|
|
|
|
|
getYear: function(){return this._p.year;},
|
|
|
|
|
getAge: function(){return this._p.age;},
|
|
|
|
|
getIndex: function(){return this._p.index;},
|
|
|
|
|
getGanZhi: function(){
|
|
|
|
|
var offset = LunarUtil.getJiaZiIndex(this._p.lunar.getTimeInGanZhi());
|
|
|
|
|
var add = this._p.index + 1;
|
|
|
|
|
if (this._p.daYun.getIndex() > 0) {
|
|
|
|
|
add += this._p.daYun.getStartAge() - 1;
|
|
|
|
|
}
|
|
|
|
|
offset += this._p.forward ? add : -add;
|
|
|
|
|
var size = LunarUtil.JIA_ZI.length;
|
|
|
|
|
while (offset < 0) {
|
|
|
|
|
offset += size;
|
|
|
|
|
}
|
|
|
|
|
offset %= size;
|
|
|
|
|
return LunarUtil.JIA_ZI[offset];
|
|
|
|
|
},
|
|
|
|
|
getXun:function(){return LunarUtil.getXun(this.getGanZhi());},
|
|
|
|
|
getXunKong:function(){return LunarUtil.getXunKong(this.getGanZhi());}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var buildDaYun = function(yun, index){
|
|
|
|
|
var birthYear = yun.getLunar().getSolar().getYear();
|
|
|
|
|
var year = yun.getStartSolar().getYear();
|
|
|
|
|
var startYear;
|
|
|
|
|
var startAge;
|
|
|
|
|
var endYear;
|
|
|
|
|
var endAge;
|
|
|
|
|
if (index < 1) {
|
|
|
|
|
startYear = birthYear;
|
|
|
|
|
startAge = 1;
|
|
|
|
|
endYear = year - 1;
|
|
|
|
|
endAge = year - birthYear;
|
|
|
|
|
} else {
|
|
|
|
|
var add = (index - 1) * 10;
|
|
|
|
|
startYear = year + add;
|
|
|
|
|
startAge = startYear - birthYear + 1;
|
|
|
|
|
endYear = startYear + 9;
|
|
|
|
|
endAge = startAge + 9;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
startYear: startYear,
|
|
|
|
|
endYear: endYear,
|
|
|
|
|
startAge: startAge,
|
|
|
|
|
endAge: endAge,
|
|
|
|
|
index: index,
|
|
|
|
|
yun: yun,
|
|
|
|
|
lunar: yun.getLunar()
|
|
|
|
|
},
|
|
|
|
|
getStartYear: function(){return this._p.startYear;},
|
|
|
|
|
getEndYear: function(){return this._p.endYear;},
|
|
|
|
|
getStartAge: function(){return this._p.startAge;},
|
|
|
|
|
getEndAge: function(){return this._p.endAge;},
|
|
|
|
|
getIndex: function(){return this._p.index;},
|
|
|
|
|
getLunar: function(){return this._p.lunar;},
|
|
|
|
|
getGanZhi: function(){
|
|
|
|
|
if (this._p.index < 1) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
var offset = LunarUtil.getJiaZiIndex(this._p.lunar.getMonthInGanZhiExact());
|
|
|
|
|
offset += this._p.yun.isForward() ? this._p.index : -this._p.index;
|
|
|
|
|
var size = LunarUtil.JIA_ZI.length;
|
|
|
|
|
if (offset >= size) {
|
|
|
|
|
offset -= size;
|
|
|
|
|
}
|
|
|
|
|
if (offset < 0) {
|
|
|
|
|
offset += size;
|
|
|
|
|
}
|
|
|
|
|
return LunarUtil.JIA_ZI[offset];
|
|
|
|
|
},
|
|
|
|
|
getXun:function(){return LunarUtil.getXun(this.getGanZhi());},
|
|
|
|
|
getXunKong:function(){return LunarUtil.getXunKong(this.getGanZhi());},
|
|
|
|
|
getLiuNian: function(n){
|
|
|
|
|
if (!n) {
|
|
|
|
|
n = 10;
|
|
|
|
|
}
|
|
|
|
|
if (this._p.index < 1) {
|
|
|
|
|
n = this._p.endYear-this._p.startYear+1;
|
|
|
|
|
}
|
|
|
|
|
var l = [];
|
|
|
|
|
for (var i = 0; i < n; i++) {
|
|
|
|
|
l.push(buildLiuNian(this,i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
getXiaoYun: function(n){
|
|
|
|
|
if (!n) {
|
|
|
|
|
n = 10;
|
|
|
|
|
}
|
|
|
|
|
if (this._p.index < 1) {
|
|
|
|
|
n = this._p.endYear-this._p.startYear+1;
|
|
|
|
|
}
|
|
|
|
|
var l = [];
|
|
|
|
|
for (var i = 0; i < n; i++) {
|
|
|
|
|
l.push(buildXiaoYun(this,i,this._p.yun.isForward()));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
gender: gender,
|
|
|
|
|
startYear: start.year,
|
|
|
|
|
startMonth: start.month,
|
|
|
|
|
startDay: start.day,
|
|
|
|
|
forward: forward,
|
|
|
|
|
lunar: lunar
|
|
|
|
|
},
|
|
|
|
|
getGender: function(){return this._p.gender;},
|
|
|
|
|
getStartYear: function(){return this._p.startYear;},
|
|
|
|
|
getStartMonth: function(){return this._p.startMonth;},
|
|
|
|
|
getStartDay: function(){return this._p.startDay;},
|
|
|
|
|
isForward: function(){return this._p.forward;},
|
|
|
|
|
getLunar: function(){return this._p.lunar;},
|
|
|
|
|
getStartSolar: function(){
|
|
|
|
|
var birth = this._p.lunar.getSolar();
|
|
|
|
|
var c = ExactDate.fromYmdHms(birth.getYear(), birth.getMonth(), birth.getDay(), birth.getHour(), birth.getMinute(), birth.getSecond());
|
|
|
|
|
c.setFullYear(birth.getYear() + this._p.startYear);
|
|
|
|
|
c.setMonth(birth.getMonth()-1+this._p.startMonth);
|
|
|
|
|
c.setDate(birth.getDay() + this._p.startDay);
|
|
|
|
|
return Solar.fromDate(c);
|
|
|
|
|
},
|
|
|
|
|
getDaYun: function(n){
|
|
|
|
|
if (!n) {
|
|
|
|
|
n = 10;
|
|
|
|
|
}
|
|
|
|
|
var l = [];
|
|
|
|
|
for (var i = 0; i < n; i++) {
|
|
|
|
|
l.push(buildDaYun(this,i));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
toString:function(){return this.getYear()+' '+this.getMonth()+' '+this.getDay()+' '+this.getTime();}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
MONTH_ZHI:['','寅','卯','辰','巳','午','未','申','酉','戌','亥','子','丑'],
|
|
|
|
|
CHANG_SHENG:['长生','沐浴','冠带','临官','帝旺','衰','病','死','墓','绝','胎','养'],
|
|
|
|
|
fromLunar:function(lunar){return _fromLunar(lunar);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var LunarTime = (function(){
|
|
|
|
|
var _fromYmdHms=function(lunarYear,lunarMonth,lunarDay,hour,minute,second){
|
|
|
|
|
var lunar=Lunar.fromYmdHms(lunarYear,lunarMonth,lunarDay,hour,minute,second);
|
|
|
|
|
var zhiIndex=LunarUtil.getTimeZhiIndex([(hour<10?'0':'')+hour,(minute<10?'0':'')+minute].join(':'));
|
|
|
|
|
var ganIndex = (lunar.getDayGanIndexExact() % 5 * 2 + zhiIndex) % 10;
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
ganIndex:ganIndex,
|
|
|
|
|
zhiIndex:zhiIndex,
|
|
|
|
|
lunar:lunar
|
|
|
|
|
},
|
|
|
|
|
getGanIndex:function(){return this._p.ganIndex;},
|
|
|
|
|
getZhiIndex:function(){return this._p.zhiIndex;},
|
|
|
|
|
getGan:function(){return LunarUtil.GAN[this._p.ganIndex+1];},
|
|
|
|
|
getZhi:function(){return LunarUtil.ZHI[this._p.zhiIndex+1];},
|
|
|
|
|
getGanZhi:function(){return this.getGan()+this.getZhi();},
|
|
|
|
|
getShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.zhiIndex+1];},
|
|
|
|
|
getPositionXi:function(){return LunarUtil.POSITION_XI[this._p.ganIndex + 1];},
|
|
|
|
|
getPositionXiDesc:function(){return LunarUtil.POSITION_DESC[this.getPositionXi()];},
|
|
|
|
|
getPositionYangGui:function(){return LunarUtil.POSITION_YANG_GUI[this._p.ganIndex + 1];},
|
|
|
|
|
getPositionYangGuiDesc:function(){return LunarUtil.POSITION_DESC[this.getPositionYangGui()];},
|
|
|
|
|
getPositionYinGui:function(){return LunarUtil.POSITION_YIN_GUI[this._p.ganIndex + 1];},
|
|
|
|
|
getPositionYinGuiDesc:function(){return LunarUtil.POSITION_DESC[this.getPositionYinGui()];},
|
|
|
|
|
getPositionFu:function(sect){return (1===sect?LunarUtil.POSITION_FU:LunarUtil.POSITION_FU_2)[this._p.ganIndex + 1];},
|
|
|
|
|
getPositionFuDesc:function(sect){return LunarUtil.POSITION_DESC[this.getPositionFu(sect)];},
|
|
|
|
|
getPositionCai:function(){return LunarUtil.POSITION_CAI[this._p.ganIndex + 1];},
|
|
|
|
|
getPositionCaiDesc:function(){return LunarUtil.POSITION_DESC[this.getPositionCai()];},
|
|
|
|
|
getNaYin:function(){return LunarUtil.NAYIN[this.getGanZhi()];},
|
|
|
|
|
getTianShen:function(){
|
|
|
|
|
return LunarUtil.TIAN_SHEN[(this._p.zhiIndex + LunarUtil.ZHI_TIAN_SHEN_OFFSET[this._p.lunar.getDayZhiExact()]) % 12 + 1];
|
|
|
|
|
},
|
|
|
|
|
getTianShenType:function(){return LunarUtil.TIAN_SHEN_TYPE[this.getTianShen()];},
|
|
|
|
|
getTianShenLuck:function(){return LunarUtil.TIAN_SHEN_TYPE_LUCK[this.getTianShenType()];},
|
|
|
|
|
getChong:function(){return LunarUtil.CHONG[this.getZhi()];},
|
|
|
|
|
getSha:function(){return LunarUtil.SHA[this.getZhi()];},
|
|
|
|
|
getChongShengXiao: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 '';
|
|
|
|
|
},
|
|
|
|
|
getChongDesc:function(){return '(' + this.getChongGan() + this.getChong() + ')' + this.getChongShengXiao();},
|
|
|
|
|
getChongGan:function(){return LunarUtil.CHONG_GAN[this.getGan()];},
|
|
|
|
|
getChongGanTie:function(){return LunarUtil.CHONG_GAN_TIE[this.getGan()];},
|
|
|
|
|
getYi:function(){return LunarUtil.getTimeYi(this._p.lunar.getDayInGanZhiExact(), this.getGanZhi());},
|
|
|
|
|
getJi:function(){return LunarUtil.getTimeJi(this._p.lunar.getDayInGanZhiExact(), this.getGanZhi());},
|
|
|
|
|
getNineStar:function(){
|
|
|
|
|
var solarYmd = this._p.lunar.getSolar().toYmd();
|
|
|
|
|
var jieQi = this._p.lunar.getJieQiTable();
|
|
|
|
|
var asc = false;
|
|
|
|
|
if (solarYmd>=jieQi['冬至'].toYmd() && solarYmd<jieQi['夏至'].toYmd()) {
|
|
|
|
|
asc = true;
|
|
|
|
|
}
|
|
|
|
|
var start = asc ? 7 : 3;
|
|
|
|
|
var dayZhi = this._p.lunar.getDayZhi();
|
|
|
|
|
if ('子午卯酉'.indexOf(dayZhi)>-1) {
|
|
|
|
|
start = asc ? 1 : 9;
|
|
|
|
|
} else if ('辰戌丑未'.indexOf(dayZhi)>-1) {
|
|
|
|
|
start = asc ? 4 : 6;
|
|
|
|
|
}
|
|
|
|
|
var index = asc ? start + this._p.zhiIndex - 1 : start - this._p.zhiIndex - 1;
|
|
|
|
|
if (index > 8) {
|
|
|
|
|
index -= 9;
|
|
|
|
|
}
|
|
|
|
|
if (index < 0) {
|
|
|
|
|
index += 9;
|
|
|
|
|
}
|
|
|
|
|
return NineStar.fromIndex(index);
|
|
|
|
|
},
|
|
|
|
|
getXun:function(){return LunarUtil.getXun(this.getGanZhi());},
|
|
|
|
|
getXunKong:function(){return LunarUtil.getXunKong(this.getGanZhi());},
|
|
|
|
|
getMinHm:function(){
|
|
|
|
|
var hour = this._p.lunar.getHour();
|
|
|
|
|
if(hour <1){
|
|
|
|
|
return '00:00';
|
|
|
|
|
}else if(hour > 22){
|
|
|
|
|
return '23:00';
|
|
|
|
|
}
|
|
|
|
|
if(hour%2===0){
|
|
|
|
|
hour-=1;
|
|
|
|
|
}
|
|
|
|
|
return (hour<10?'0':'')+hour+':00';
|
|
|
|
|
},
|
|
|
|
|
getMaxHm:function(){
|
|
|
|
|
var hour = this._p.lunar.getHour();
|
|
|
|
|
if (hour <1){
|
|
|
|
|
return '00:59';
|
|
|
|
|
} else if (hour > 22) {
|
|
|
|
|
return '23:59';
|
|
|
|
|
}
|
|
|
|
|
if(hour%2!==0){
|
|
|
|
|
hour+=1;
|
|
|
|
|
}
|
|
|
|
|
return (hour<10?'0':'')+hour+':59';
|
|
|
|
|
},
|
|
|
|
|
toString:function(){return this.getGanZhi();}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
fromYmdHms:function(lunarYear,lunarMonth,lunarDay,hour,minute,second){return _fromYmdHms(lunarYear,lunarMonth,lunarDay,hour,minute,second);},
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var FotoUtil = (function(){
|
|
|
|
|
var XIU_OFFSET = [11, 13, 15, 17, 19, 21, 24, 0, 2, 4, 7, 9];
|
|
|
|
|
var _f=function(name,result,everyMonth,remark){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
name:name,
|
|
|
|
|
result:result?result:'',
|
|
|
|
|
everyMonth:everyMonth?true:false,
|
|
|
|
|
remark:remark?remark:''
|
|
|
|
|
},
|
|
|
|
|
getName:function(){return this._p.name;},
|
|
|
|
|
getResult:function(){return this._p.result;},
|
|
|
|
|
isEveryMonth:function(){return this._p.everyMonth;},
|
|
|
|
|
getRemark:function(){return this._p.remark;},
|
|
|
|
|
toString:function(){return this._p.name;},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var l = [this._p.name];
|
|
|
|
|
if(this._p.result) {
|
|
|
|
|
l.push(this._p.result);
|
|
|
|
|
}
|
|
|
|
|
if(this._p.remark) {
|
|
|
|
|
l.push(this._p.remark);
|
|
|
|
|
}
|
|
|
|
|
return l.join(' ');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var _getXiu=function(m,d){
|
|
|
|
|
return FotoUtil.XIU_27[(XIU_OFFSET[Math.abs(m)-1] + d - 1) % FotoUtil.XIU_27.length];
|
|
|
|
|
};
|
|
|
|
|
var dj='犯者夺纪';
|
|
|
|
|
var js='犯者减寿';
|
|
|
|
|
var ss='犯者损寿';
|
|
|
|
|
var xl='犯者削禄夺纪';
|
|
|
|
|
var jw='犯者三年内夫妇俱亡';
|
|
|
|
|
var _y=_f('杨公忌');
|
|
|
|
|
var _t=_f('四天王巡行', '', true);
|
|
|
|
|
var _d=_f('斗降', dj, true);
|
|
|
|
|
var _s=_f('月朔', dj, true);
|
|
|
|
|
var _w=_f('月望', dj, true);
|
|
|
|
|
var _h=_f('月晦', js, true);
|
|
|
|
|
var _l=_f('雷斋日', js, true);
|
|
|
|
|
var _j=_f('九毒日', '犯者夭亡,奇祸不测');
|
|
|
|
|
var _r=_f('人神在阴', '犯者得病', true, '宜先一日即戒');
|
|
|
|
|
var _m=_f('司命奏事', js, true, '如月小,即戒廿九');
|
|
|
|
|
var _hh=_f('月晦', js, true, '如月小,即戒廿九');
|
|
|
|
|
return {
|
|
|
|
|
XIU_27:['角','亢','氐','房','心','尾','箕','斗','女','虚','危','室','壁','奎','娄','胃','昴','毕','觜','参','井','鬼','柳','星','张','翼','轸'],
|
|
|
|
|
DAY_ZHAI_GUAN_YIN:['1-8','2-7','2-9','2-19','3-3','3-6','3-13','4-22','5-3','5-17','6-16','6-18','6-19','6-23','7-13','8-16','9-19','9-23','10-2','11-19','11-24','12-25'],
|
|
|
|
|
FESTIVAL:{
|
|
|
|
|
'1-1': [_f('天腊,玉帝校世人神气禄命', xl), _s],
|
|
|
|
|
'1-3': [_f('万神都会', dj), _d],
|
|
|
|
|
'1-5': [_f('五虚忌')],
|
|
|
|
|
'1-6': [_f('六耗忌'), _l],
|
|
|
|
|
'1-7': [_f('上会日', ss)],
|
|
|
|
|
'1-8': [_f('五殿阎罗天子诞', dj), _t],
|
|
|
|
|
'1-9': [_f('玉皇上帝诞', dj)],
|
|
|
|
|
'1-13': [_y],
|
|
|
|
|
'1-14': [_f('三元降', js), _t],
|
|
|
|
|
'1-15': [_f('三元降', js), _f('上元神会', dj), _w, _t],
|
|
|
|
|
'1-16': [_f('三元降', js)],
|
|
|
|
|
'1-19': [_f('长春真人诞')],
|
|
|
|
|
'1-23': [_f('三尸神奏事'), _t],
|
|
|
|
|
'1-25': [_h, _f('天地仓开日', '犯者损寿,子带疾')],
|
|
|
|
|
'1-27': [_d],
|
|
|
|
|
'1-28': [_r],
|
|
|
|
|
'1-29': [_t],
|
|
|
|
|
'1-30': [_hh, _m, _t],
|
|
|
|
|
'2-1': [_f('一殿秦广王诞', dj), _s],
|
|
|
|
|
'2-2': [_f('万神都会', dj), _f('福德土地正神诞', '犯者得祸')],
|
|
|
|
|
'2-3': [_f('文昌帝君诞', xl), _d],
|
|
|
|
|
'2-6': [_f('东华帝君诞'), _l],
|
|
|
|
|
'2-8': [_f('释迦牟尼佛出家', dj), _f('三殿宋帝王诞', dj), _f('张大帝诞', dj), _t],
|
|
|
|
|
'2-11': [_y],
|
|
|
|
|
'2-14': [_t],
|
|
|
|
|
'2-15': [_f('释迦牟尼佛涅槃', xl), _f('太上老君诞', xl), _f('月望', xl, true), _t],
|
|
|
|
|
'2-17': [_f('东方杜将军诞')],
|
|
|
|
|
'2-18': [_f('四殿五官王诞', xl), _f('至圣先师孔子讳辰', xl)],
|
|
|
|
|
'2-19': [_f('观音大士诞', dj)],
|
|
|
|
|
'2-21': [_f('普贤菩萨诞')],
|
|
|
|
|
'2-23': [_t],
|
|
|
|
|
'2-25': [_h],
|
|
|
|
|
'2-27': [_d],
|
|
|
|
|
'2-28': [_r],
|
|
|
|
|
'2-29': [_t],
|
|
|
|
|
'2-30': [_hh, _m, _t],
|
|
|
|
|
'3-1': [_f('二殿楚江王诞', dj), _s],
|
|
|
|
|
'3-3': [_f('玄天上帝诞', dj), _d],
|
|
|
|
|
'3-6': [_l],
|
|
|
|
|
'3-8': [_f('六殿卞城王诞', dj), _t],
|
|
|
|
|
'3-9': [_f('牛鬼神出', '犯者产恶胎'), _y],
|
|
|
|
|
'3-12': [_f('中央五道诞')],
|
|
|
|
|
'3-14': [_t],
|
|
|
|
|
'3-15': [_f('昊天上帝诞', dj), _f('玄坛诞', dj), _w, _t],
|
|
|
|
|
'3-16': [_f('准提菩萨诞', dj)],
|
|
|
|
|
'3-19': [_f('中岳大帝诞'), _f('后土娘娘诞'), _f('三茅降')],
|
|
|
|
|
'3-20': [_f('天地仓开日', ss), _f('子孙娘娘诞')],
|
|
|
|
|
'3-23': [_t],
|
|
|
|
|
'3-25': [_h],
|
|
|
|
|
'3-27': [_f('七殿泰山王诞'), _d],
|
|
|
|
|
'3-28': [_r, _f('苍颉至圣先师诞', xl), _f('东岳大帝诞')],
|
|
|
|
|
'3-29': [_t],
|
|
|
|
|
'3-30': [_hh, _m, _t],
|
|
|
|
|
'4-1': [_f('八殿都市王诞', dj), _s],
|
|
|
|
|
'4-3': [_d],
|
|
|
|
|
'4-4': [_f('万神善会', '犯者失瘼夭胎'), _f('文殊菩萨诞')],
|
|
|
|
|
'4-6': [_l],
|
|
|
|
|
'4-7': [_f('南斗、北斗、西斗同降', js), _y],
|
|
|
|
|
'4-8': [_f('释迦牟尼佛诞', dj), _f('万神善会', '犯者失瘼夭胎'), _f('善恶童子降', '犯者血死'), _f('九殿平等王诞'), _t],
|
|
|
|
|
'4-14': [_f('纯阳祖师诞', js), _t],
|
|
|
|
|
'4-15': [_w, _f('钟离祖师诞'), _t],
|
|
|
|
|
'4-16': [_f('天地仓开日', ss)],
|
|
|
|
|
'4-17': [_f('十殿转轮王诞', dj)],
|
|
|
|
|
'4-18': [_f('天地仓开日', ss), _f('紫徽大帝诞', ss)],
|
|
|
|
|
'4-20': [_f('眼光圣母诞')],
|
|
|
|
|
'4-23': [_t],
|
|
|
|
|
'4-25': [_h],
|
|
|
|
|
'4-27': [_d],
|
|
|
|
|
'4-28': [_r],
|
|
|
|
|
'4-29': [_t],
|
|
|
|
|
'4-30': [_hh, _m, _t],
|
|
|
|
|
'5-1': [_f('南极长生大帝诞', dj), _s],
|
|
|
|
|
'5-3': [_d],
|
|
|
|
|
'5-5': [_f('地腊', xl), _f('五帝校定生人官爵', xl), _j, _y],
|
|
|
|
|
'5-6': [_j, _l],
|
|
|
|
|
'5-7': [_j],
|
|
|
|
|
'5-8': [_f('南方五道诞'), _t],
|
|
|
|
|
'5-11': [_f('天地仓开日', ss),_f('天下都城隍诞')],
|
|
|
|
|
'5-12': [_f('炳灵公诞')],
|
|
|
|
|
'5-13': [_f('关圣降', xl)],
|
|
|
|
|
'5-14': [_f('夜子时为天地交泰', jw), _t],
|
|
|
|
|
'5-15': [_w, _j, _t],
|
|
|
|
|
'5-16': [_f('九毒日', jw), _f('天地元气造化万物之辰', jw)],
|
|
|
|
|
'5-17': [_j],
|
|
|
|
|
'5-18': [_f('张天师诞')],
|
|
|
|
|
'5-22': [_f('孝娥神诞', dj)],
|
|
|
|
|
'5-23': [_t],
|
|
|
|
|
'5-25': [_j, _h],
|
|
|
|
|
'5-26': [_j],
|
|
|
|
|
'5-27': [_j, _d],
|
|
|
|
|
'5-28': [_r],
|
|
|
|
|
'5-29': [_t],
|
|
|
|
|
'5-30': [_hh, _m, _t],
|
|
|
|
|
'6-1': [_s],
|
|
|
|
|
'6-3': [_f('韦驮菩萨圣诞'), _d, _y],
|
|
|
|
|
'6-5': [_f('南赡部洲转大轮', ss)],
|
|
|
|
|
'6-6': [_f('天地仓开日', ss), _l],
|
|
|
|
|
'6-8': [_t],
|
|
|
|
|
'6-10': [_f('金粟如来诞')],
|
|
|
|
|
'6-14': [_t],
|
|
|
|
|
'6-15': [_w, _t],
|
|
|
|
|
'6-19': [_f('观世音菩萨成道', dj)],
|
|
|
|
|
'6-23': [_f('南方火神诞', '犯者遭回禄'), _t],
|
|
|
|
|
'6-24': [_f('雷祖诞', xl), _f('关帝诞', xl)],
|
|
|
|
|
'6-25': [_h],
|
|
|
|
|
'6-27': [_d],
|
|
|
|
|
'6-28': [_r],
|
|
|
|
|
'6-29': [_t],
|
|
|
|
|
'6-30': [_hh, _m, _t],
|
|
|
|
|
'7-1': [_s, _y],
|
|
|
|
|
'7-3': [_d],
|
|
|
|
|
'7-5': [_f('中会日', ss, false, '一作初七')],
|
|
|
|
|
'7-6': [_l],
|
|
|
|
|
'7-7': [_f('道德腊', xl), _f('五帝校生人善恶', xl), _f('魁星诞', xl)],
|
|
|
|
|
'7-8': [_t],
|
|
|
|
|
'7-10': [_f('阴毒日', '', false, '大忌')],
|
|
|
|
|
'7-12': [_f('长真谭真人诞')],
|
|
|
|
|
'7-13': [_f('大势至菩萨诞', js)],
|
|
|
|
|
'7-14': [_f('三元降', js), _t],
|
|
|
|
|
'7-15': [_w, _f('三元降', dj),_f('地官校籍', dj), _t],
|
|
|
|
|
'7-16': [_f('三元降', js)],
|
|
|
|
|
'7-18': [_f('西王母诞', dj)],
|
|
|
|
|
'7-19': [_f('太岁诞', dj)],
|
|
|
|
|
'7-22': [_f('增福财神诞', xl)],
|
|
|
|
|
'7-23': [_t],
|
|
|
|
|
'7-25': [_h],
|
|
|
|
|
'7-27': [_d],
|
|
|
|
|
'7-28': [_r],
|
|
|
|
|
'7-29': [_y, _t],
|
|
|
|
|
'7-30': [_f('地藏菩萨诞', dj), _hh, _m, _t],
|
|
|
|
|
'8-1': [_s, _f('许真君诞')],
|
|
|
|
|
'8-3': [_d, _f('北斗诞', xl), _f('司命灶君诞', '犯者遭回禄')],
|
|
|
|
|
'8-5': [_f('雷声大帝诞', dj)],
|
|
|
|
|
'8-6': [_l],
|
|
|
|
|
'8-8': [_t],
|
|
|
|
|
'8-10': [_f('北斗大帝诞')],
|
|
|
|
|
'8-12': [_f('西方五道诞')],
|
|
|
|
|
'8-14': [_t],
|
|
|
|
|
'8-15': [_w, _f('太明朝元', '犯者暴亡', false, '宜焚香守夜'), _t],
|
|
|
|
|
'8-16': [_f('天曹掠刷真君降', '犯者贫夭')],
|
|
|
|
|
'8-18': [_f('天人兴福之辰', '', false, '宜斋戒,存想吉事')],
|
|
|
|
|
'8-23': [_f('汉恒候张显王诞'), _t],
|
|
|
|
|
'8-24': [_f('灶君夫人诞')],
|
|
|
|
|
'8-25': [_h],
|
|
|
|
|
'8-27': [_d, _f('至圣先师孔子诞', xl), _y],
|
|
|
|
|
'8-28': [_r, _f('四天会事')],
|
|
|
|
|
'8-29': [_t],
|
|
|
|
|
'8-30': [_f('诸神考校', '犯者夺算'), _hh, _m, _t],
|
|
|
|
|
'9-1': [_s, _f('南斗诞', xl), _f('北斗九星降世', dj, false, '此九日俱宜斋戒')],
|
|
|
|
|
'9-3': [_d, _f('五瘟神诞')],
|
|
|
|
|
'9-6': [_l],
|
|
|
|
|
'9-8': [_t],
|
|
|
|
|
'9-9': [_f('斗母诞', xl), _f('酆都大帝诞'), _f('玄天上帝飞升')],
|
|
|
|
|
'9-10': [_f('斗母降', dj)],
|
|
|
|
|
'9-11': [_f('宜戒')],
|
|
|
|
|
'9-13': [_f('孟婆尊神诞')],
|
|
|
|
|
'9-14': [_t],
|
|
|
|
|
'9-15': [_w, _t],
|
|
|
|
|
'9-17': [_f('金龙四大王诞', '犯者遭水厄')],
|
|
|
|
|
'9-19': [_f('日宫月宫会合', js), _f('观世音菩萨诞', js)],
|
|
|
|
|
'9-23': [_t],
|
|
|
|
|
'9-25': [_h, _y],
|
|
|
|
|
'9-27': [_d],
|
|
|
|
|
'9-28': [_r],
|
|
|
|
|
'9-29': [_t],
|
|
|
|
|
'9-30': [_f('药师琉璃光佛诞', '犯者危疾'), _hh, _m, _t],
|
|
|
|
|
'10-1': [_s, _f('民岁腊', dj), _f('四天王降', '犯者一年内死')],
|
|
|
|
|
'10-3': [_d, _f('三茅诞')],
|
|
|
|
|
'10-5': [_f('下会日', js), _f('达摩祖师诞', js)],
|
|
|
|
|
'10-6': [_l, _f('天曹考察', dj)],
|
|
|
|
|
'10-8': [_f('佛涅槃日', '', false, '大忌色欲'), _t],
|
|
|
|
|
'10-10': [_f('四天王降', '犯者一年内死')],
|
|
|
|
|
'10-11': [_f('宜戒')],
|
|
|
|
|
'10-14': [_f('三元降', js), _t],
|
|
|
|
|
'10-15': [_w, _f('三元降', dj), _f('下元水府校籍', dj), _t],
|
|
|
|
|
'10-16': [_f('三元降', js), _t],
|
|
|
|
|
'10-23': [_y, _t],
|
|
|
|
|
'10-25': [_h],
|
|
|
|
|
'10-27': [_d, _f('北极紫徽大帝降')],
|
|
|
|
|
'10-28': [_r],
|
|
|
|
|
'10-29': [_t],
|
|
|
|
|
'10-30': [_hh, _m, _t],
|
|
|
|
|
'11-1': [_s],
|
|
|
|
|
'11-3': [_d],
|
|
|
|
|
'11-4': [_f('至圣先师孔子诞', xl)],
|
|
|
|
|
'11-6': [_f('西岳大帝诞')],
|
|
|
|
|
'11-8': [_t],
|
|
|
|
|
'11-11': [_f('天地仓开日', dj), _f('太乙救苦天尊诞', dj)],
|
|
|
|
|
'11-14': [_t],
|
|
|
|
|
'11-15': [_f('月望', '上半夜犯男死 下半夜犯女死'), _f('四天王巡行', '上半夜犯男死 下半夜犯女死')],
|
|
|
|
|
'11-17': [_f('阿弥陀佛诞')],
|
|
|
|
|
'11-19': [_f('太阳日宫诞', '犯者得奇祸')],
|
|
|
|
|
'11-21': [_y],
|
|
|
|
|
'11-23': [_f('张仙诞', '犯者绝嗣'), _t],
|
|
|
|
|
'11-25': [_f('掠刷大夫降', '犯者遭大凶'), _h],
|
|
|
|
|
'11-26': [_f('北方五道诞')],
|
|
|
|
|
'11-27': [_d],
|
|
|
|
|
'11-28': [_r],
|
|
|
|
|
'11-29': [_t],
|
|
|
|
|
'11-30': [_hh, _m, _t],
|
|
|
|
|
'12-1': [_s],
|
|
|
|
|
'12-3': [_d],
|
|
|
|
|
'12-6': [_f('天地仓开日', js), _l],
|
|
|
|
|
'12-7': [_f('掠刷大夫降', '犯者得恶疾')],
|
|
|
|
|
'12-8': [_f('王侯腊', dj), _f('释迦如来成佛之辰'), _t, _f('初旬内戊日,亦名王侯腊', dj)],
|
|
|
|
|
'12-12': [_f('太素三元君朝真')],
|
|
|
|
|
'12-14': [_t],
|
|
|
|
|
'12-15': [_w, _t],
|
|
|
|
|
'12-16': [_f('南岳大帝诞')],
|
|
|
|
|
'12-19': [_y],
|
|
|
|
|
'12-20': [_f('天地交道', '犯者促寿')],
|
|
|
|
|
'12-21': [_f('天猷上帝诞')],
|
|
|
|
|
'12-23': [_f('五岳诞降'), _t],
|
|
|
|
|
'12-24': [_f('司今朝天奏人善恶', '犯者得大祸')],
|
|
|
|
|
'12-25': [_f('三清玉帝同降,考察善恶', '犯者得奇祸'), _h],
|
|
|
|
|
'12-27': [_d],
|
|
|
|
|
'12-28': [_r],
|
|
|
|
|
'12-29': [_f('华严菩萨诞'), _t],
|
|
|
|
|
'12-30': [_f('诸神下降,察访善恶', '犯者男女俱亡')]
|
|
|
|
|
},
|
|
|
|
|
getXiu:function(m,d){return _getXiu(m,d);}
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
var Foto = (function(){
|
|
|
|
|
var _fromYmdHms=function(y,m,d,hour,minute,second){
|
|
|
|
|
return _fromLunar(Lunar.fromYmdHms(y+Foto.DEAD_YEAR-1,m,d,hour,minute,second));
|
|
|
|
|
};
|
|
|
|
|
var _fromLunar=function(lunar){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
lunar: lunar
|
|
|
|
|
},
|
|
|
|
|
getLunar:function(){return this._p.lunar;},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
var sy = this._p.lunar.getSolar().getYear();
|
|
|
|
|
var y = sy-Foto.DEAD_YEAR;
|
|
|
|
|
if(sy===this._p.lunar.getYear()){
|
|
|
|
|
y++;
|
|
|
|
|
}
|
|
|
|
|
return y;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){return this._p.lunar.getMonth();},
|
|
|
|
|
getDay:function(){return this._p.lunar.getDay();},
|
|
|
|
|
getYearInChinese:function(){
|
|
|
|
|
var y = this.getYear()+'';
|
|
|
|
|
var s = '';
|
|
|
|
|
var zero = '0'.charCodeAt(0);
|
|
|
|
|
for(var i=0,j=y.length;i<j;i++){
|
|
|
|
|
s+=LunarUtil.NUMBER[y.charCodeAt(i)-zero];
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
},
|
|
|
|
|
getMonthInChinese:function(){return this._p.lunar.getMonthInChinese();},
|
|
|
|
|
getDayInChinese:function(){return this._p.lunar.getDayInChinese();},
|
|
|
|
|
getFestivals:function(){
|
|
|
|
|
var l = FotoUtil.FESTIVAL[this.getMonth()+'-'+this.getDay()];
|
|
|
|
|
return l?l:[];
|
|
|
|
|
},
|
|
|
|
|
isMonthZhai:function(){
|
|
|
|
|
var m = this.getMonth();
|
|
|
|
|
return 1===m||5===m||9===m;
|
|
|
|
|
},
|
|
|
|
|
isDayYangGong:function(){
|
|
|
|
|
var l = this.getFestivals();
|
|
|
|
|
for(var i=0,j=l.length;i<j;i++){
|
|
|
|
|
if('杨公忌'===l[i].getName()){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
isDayZhaiShuoWang:function(){
|
|
|
|
|
var d = this.getDay();
|
|
|
|
|
return 1===d||15===d;
|
|
|
|
|
},
|
|
|
|
|
isDayZhaiSix:function(){
|
|
|
|
|
var d = this.getDay();
|
|
|
|
|
if(8===d||14===d||15===d||23===d||29===d||30===d){
|
|
|
|
|
return true;
|
|
|
|
|
}else if(28===d){
|
|
|
|
|
var m = LunarMonth.fromYm(this._p.lunar.getYear(), this.getMonth());
|
|
|
|
|
if(30!==m.getDayCount()){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
isDayZhaiTen:function() {
|
|
|
|
|
var d = this.getDay();
|
|
|
|
|
return 1===d||8===d||14===d||15===d||18===d||23===d||24===d||28===d||29===d||30===d;
|
|
|
|
|
},
|
|
|
|
|
isDayZhaiGuanYin:function() {
|
|
|
|
|
var k = this.getMonth()+'-'+this.getDay();
|
|
|
|
|
for(var i=0,j=FotoUtil.DAY_ZHAI_GUAN_YIN.length;i<j;i++){
|
|
|
|
|
if(k===FotoUtil.DAY_ZHAI_GUAN_YIN[i]){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
getXiu:function(){
|
|
|
|
|
return FotoUtil.getXiu(this.getMonth(), this.getDay());
|
|
|
|
|
},
|
|
|
|
|
getXiuLuck:function(){
|
|
|
|
|
return LunarUtil.XIU_LUCK[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getXiuSong:function(){
|
|
|
|
|
return LunarUtil.XIU_SONG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getZheng:function(){
|
|
|
|
|
return LunarUtil.ZHENG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getAnimal:function(){
|
|
|
|
|
return LunarUtil.ANIMAL[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getGong:function(){
|
|
|
|
|
return LunarUtil.GONG[this.getXiu()];
|
|
|
|
|
},
|
|
|
|
|
getShou:function(){
|
|
|
|
|
return LunarUtil.SHOU[this.getGong()];
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYearInChinese()+'年'+this.getMonthInChinese()+'月'+this.getDayInChinese();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var s = this.toString();
|
|
|
|
|
var fs = this.getFestivals();
|
|
|
|
|
for(var i=0,j=fs.length;i<j;i++){
|
|
|
|
|
s += ' ('+fs[i]+')';
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
DEAD_YEAR:-543,
|
|
|
|
|
fromYmdHms:function(y,m,d,hour,minute,second){return _fromYmdHms(y,m,d,hour,minute,second);},
|
|
|
|
|
fromYmd:function(y,m,d){return _fromYmdHms(y,m,d,0,0,0);},
|
|
|
|
|
fromLunar:function(lunar){return _fromLunar(lunar);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var TaoFestival = (function(){
|
|
|
|
|
var _f=function(name,remark){
|
|
|
|
|
return {
|
|
|
|
|
_p:{
|
|
|
|
|
name:name,
|
|
|
|
|
remark:remark?remark:''
|
|
|
|
|
},
|
|
|
|
|
getName:function(){return this._p.name;},
|
|
|
|
|
getRemark:function(){return this._p.remark;},
|
|
|
|
|
toString:function(){return this._p.name;},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
var l = [this._p.name];
|
|
|
|
|
if(this._p.remark) {
|
|
|
|
|
l.push('['+this._p.remark+']');
|
|
|
|
|
}
|
|
|
|
|
return l.join('');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
create:function(name,remark){return _f(name,remark);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
var TaoUtil = (function(){
|
|
|
|
|
var _f = TaoFestival.create;
|
|
|
|
|
return {
|
|
|
|
|
SAN_HUI:['1-7','7-7','10-15'],
|
|
|
|
|
SAN_YUAN:['1-15','7-15','10-15'],
|
|
|
|
|
WU_LA:['1-1','5-5','7-7','10-1','12-8'],
|
|
|
|
|
AN_WU:['未','戌','辰','寅','午','子','酉','申','巳','亥','卯','丑'],
|
|
|
|
|
BA_HUI:{
|
|
|
|
|
'丙午':'天会',
|
|
|
|
|
'壬午':'地会',
|
|
|
|
|
'壬子':'人会',
|
|
|
|
|
'庚午':'日会',
|
|
|
|
|
'庚申':'月会',
|
|
|
|
|
'辛酉':'星辰会',
|
|
|
|
|
'甲辰':'五行会',
|
|
|
|
|
'甲戌':'四时会'
|
|
|
|
|
},
|
|
|
|
|
BA_JIE:{
|
|
|
|
|
'立春':'东北方度仙上圣天尊同梵炁始青天君下降',
|
|
|
|
|
'春分':'东方玉宝星上天尊同青帝九炁天君下降',
|
|
|
|
|
'立夏':'东南方好生度命天尊同梵炁始丹天君下降',
|
|
|
|
|
'夏至':'南方玄真万福天尊同赤帝三炁天君下降',
|
|
|
|
|
'立秋':'西南方太灵虚皇天尊同梵炁始素天君下降',
|
|
|
|
|
'秋分':'西方太妙至极天尊同白帝七炁天君下降',
|
|
|
|
|
'立冬':'西北方无量太华天尊同梵炁始玄天君下降',
|
|
|
|
|
'冬至':'北方玄上玉宸天尊同黑帝五炁天君下降'
|
|
|
|
|
},
|
|
|
|
|
FESTIVAL: {
|
|
|
|
|
'1-1': [_f('天腊之辰', '天腊,此日五帝会于东方九炁青天')],
|
|
|
|
|
'1-3': [_f('郝真人圣诞'), _f('孙真人圣诞')],
|
|
|
|
|
'1-5': [_f('孙祖清静元君诞')],
|
|
|
|
|
'1-7': [_f('举迁赏会', '此日上元赐福,天官同地水二官考校罪福')],
|
|
|
|
|
'1-9': [_f('玉皇上帝圣诞')],
|
|
|
|
|
'1-13': [_f('关圣帝君飞升')],
|
|
|
|
|
'1-15': [_f('上元天官圣诞'), _f('老祖天师圣诞')],
|
|
|
|
|
'1-19': [_f('长春邱真人(邱处机)圣诞')],
|
|
|
|
|
'1-28': [_f('许真君(许逊天师)圣诞')],
|
|
|
|
|
'2-1': [_f('勾陈天皇大帝圣诞'), _f('长春刘真人(刘渊然)圣诞')],
|
|
|
|
|
'2-2': [_f('土地正神诞'), _f('姜太公圣诞')],
|
|
|
|
|
'2-3': [_f('文昌梓潼帝君圣诞')],
|
|
|
|
|
'2-6': [_f('东华帝君圣诞')],
|
|
|
|
|
'2-13': [_f('度人无量葛真君圣诞')],
|
|
|
|
|
'2-15': [_f('太清道德天尊(太上老君)圣诞')],
|
|
|
|
|
'2-19': [_f('慈航真人圣诞')],
|
|
|
|
|
'3-1': [_f('谭祖(谭处端)长真真人圣诞')],
|
|
|
|
|
'3-3': [_f('玄天上帝圣诞')],
|
|
|
|
|
'3-6': [_f('眼光娘娘圣诞')],
|
|
|
|
|
'3-15': [_f('天师张大真人圣诞'), _f('财神赵公元帅圣诞')],
|
|
|
|
|
'3-16': [_f('三茅真君得道之辰'), _f('中岳大帝圣诞')],
|
|
|
|
|
'3-18': [_f('王祖(王处一)玉阳真人圣诞'), _f('后土娘娘圣诞')],
|
|
|
|
|
'3-19': [_f('太阳星君圣诞')],
|
|
|
|
|
'3-20': [_f('子孙娘娘圣诞')],
|
|
|
|
|
'3-23': [_f('天后妈祖圣诞')],
|
|
|
|
|
'3-26': [_f('鬼谷先师诞')],
|
|
|
|
|
'3-28': [_f('东岳大帝圣诞')],
|
|
|
|
|
'4-1': [_f('长生谭真君成道之辰')],
|
|
|
|
|
'4-10': [_f('何仙姑圣诞')],
|
|
|
|
|
'4-14': [_f('吕祖纯阳祖师圣诞')],
|
|
|
|
|
'4-15': [_f('钟离祖师圣诞')],
|
|
|
|
|
'4-18': [_f('北极紫微大帝圣诞'), _f('泰山圣母碧霞元君诞'), _f('华佗神医先师诞')],
|
|
|
|
|
'4-20': [_f('眼光圣母娘娘诞')],
|
|
|
|
|
'4-28': [_f('神农先帝诞')],
|
|
|
|
|
'5-1': [_f('南极长生大帝圣诞')],
|
|
|
|
|
'5-5': [_f('地腊之辰', '地腊,此日五帝会于南方三炁丹天'), _f('南方雷祖圣诞'), _f('地祗温元帅圣诞'), _f('雷霆邓天君圣诞')],
|
|
|
|
|
'5-11': [_f('城隍爷圣诞')],
|
|
|
|
|
'5-13': [_f('关圣帝君降神'), _f('关平太子圣诞')],
|
|
|
|
|
'5-18': [_f('张天师圣诞')],
|
|
|
|
|
'5-20': [_f('马祖丹阳真人圣诞')],
|
|
|
|
|
'5-29': [_f('紫青白祖师圣诞')],
|
|
|
|
|
'6-1': [_f('南斗星君下降')],
|
|
|
|
|
'6-2': [_f('南斗星君下降')],
|
|
|
|
|
'6-3': [_f('南斗星君下降')],
|
|
|
|
|
'6-4': [_f('南斗星君下降')],
|
|
|
|
|
'6-5': [_f('南斗星君下降')],
|
|
|
|
|
'6-6': [_f('南斗星君下降')],
|
|
|
|
|
'6-10': [_f('刘海蟾祖师圣诞')],
|
|
|
|
|
'6-15': [_f('灵官王天君圣诞')],
|
|
|
|
|
'6-19': [_f('慈航(观音)成道日')],
|
|
|
|
|
'6-23': [_f('火神圣诞')],
|
|
|
|
|
'6-24': [_f('南极大帝中方雷祖圣诞'), _f('关圣帝君圣诞')],
|
|
|
|
|
'6-26': [_f('二郎真君圣诞')],
|
|
|
|
|
'7-7': [_f('道德腊之辰', '道德腊,此日五帝会于西方七炁素天'), _f('庆生中会', '此日中元赦罪,地官同天水二官考校罪福')],
|
|
|
|
|
'7-12': [_f('西方雷祖圣诞')],
|
|
|
|
|
'7-15': [_f('中元地官大帝圣诞')],
|
|
|
|
|
'7-18': [_f('王母娘娘圣诞')],
|
|
|
|
|
'7-20': [_f('刘祖(刘处玄)长生真人圣诞')],
|
|
|
|
|
'7-22': [_f('财帛星君文财神增福相公李诡祖圣诞')],
|
|
|
|
|
'7-26': [_f('张三丰祖师圣诞')],
|
|
|
|
|
'8-1': [_f('许真君飞升日')],
|
|
|
|
|
'8-3': [_f('九天司命灶君诞')],
|
|
|
|
|
'8-5': [_f('北方雷祖圣诞')],
|
|
|
|
|
'8-10': [_f('北岳大帝诞辰')],
|
|
|
|
|
'8-15': [_f('太阴星君诞')],
|
|
|
|
|
'9-1': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-2': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-3': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-4': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-5': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-6': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-7': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-8': [_f('北斗九皇降世之辰')],
|
|
|
|
|
'9-9': [_f('北斗九皇降世之辰'), _f('斗姥元君圣诞'), _f('重阳帝君圣诞'), _f('玄天上帝飞升'), _f('酆都大帝圣诞')],
|
|
|
|
|
'9-22': [_f('增福财神诞')],
|
|
|
|
|
'9-23': [_f('萨翁真君圣诞')],
|
|
|
|
|
'9-28': [_f('五显灵官马元帅圣诞')],
|
|
|
|
|
'10-1': [_f('民岁腊之辰', '民岁腊,此日五帝会于北方五炁黑天'), _f('东皇大帝圣诞')],
|
|
|
|
|
'10-3': [_f('三茅应化真君圣诞')],
|
|
|
|
|
'10-6': [_f('天曹诸司五岳五帝圣诞')],
|
|
|
|
|
'10-15': [_f('下元水官大帝圣诞'), _f('建生大会', '此日下元解厄,水官同天地二官考校罪福')],
|
|
|
|
|
'10-18': [_f('地母娘娘圣诞')],
|
|
|
|
|
'10-19': [_f('长春邱真君飞升')],
|
|
|
|
|
'10-20': [_f('虚靖天师(即三十代天师弘悟张真人)诞')],
|
|
|
|
|
'11-6': [_f('西岳大帝圣诞')],
|
|
|
|
|
'11-9': [_f('湘子韩祖圣诞')],
|
|
|
|
|
'11-11': [_f('太乙救苦天尊圣诞')],
|
|
|
|
|
'11-26': [_f('北方五道圣诞')],
|
|
|
|
|
'12-8': [_f('王侯腊之辰', '王侯腊,此日五帝会于上方玄都玉京')],
|
|
|
|
|
'12-16': [_f('南岳大帝圣诞'), _f('福德正神诞')],
|
|
|
|
|
'12-20': [_f('鲁班先师圣诞')],
|
|
|
|
|
'12-21': [_f('天猷上帝圣诞')],
|
|
|
|
|
'12-22': [_f('重阳祖师圣诞')],
|
|
|
|
|
'12-23': [_f('祭灶王', '最适宜谢旧年太岁,开启拜新年太岁')],
|
|
|
|
|
'12-25': [_f('玉帝巡天'), _f('天神下降')],
|
|
|
|
|
'12-29': [_f('清静孙真君(孙不二)成道')]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
var Tao = (function(){
|
|
|
|
|
var _fromYmdHms=function(y,m,d,hour,minute,second){
|
|
|
|
|
return _fromLunar(Lunar.fromYmdHms(y+Tao.BIRTH_YEAR,m,d,hour,minute,second));
|
|
|
|
|
};
|
|
|
|
|
var _fromLunar=function(lunar){
|
|
|
|
|
return {
|
|
|
|
|
_p: {
|
|
|
|
|
lunar: lunar
|
|
|
|
|
},
|
|
|
|
|
getLunar:function(){return this._p.lunar;},
|
|
|
|
|
getYear:function(){
|
|
|
|
|
return this._p.lunar.getYear()-Tao.BIRTH_YEAR;
|
|
|
|
|
},
|
|
|
|
|
getMonth:function(){return this._p.lunar.getMonth();},
|
|
|
|
|
getDay:function(){return this._p.lunar.getDay();},
|
|
|
|
|
getYearInChinese:function(){
|
|
|
|
|
var y = this.getYear()+'';
|
|
|
|
|
var s = '';
|
|
|
|
|
var zero = '0'.charCodeAt(0);
|
|
|
|
|
for(var i=0,j=y.length;i<j;i++){
|
|
|
|
|
s+=LunarUtil.NUMBER[y.charCodeAt(i)-zero];
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
},
|
|
|
|
|
getMonthInChinese:function(){return this._p.lunar.getMonthInChinese();},
|
|
|
|
|
getDayInChinese:function(){return this._p.lunar.getDayInChinese();},
|
|
|
|
|
getFestivals:function(){
|
|
|
|
|
var l=[];
|
|
|
|
|
var fs=TaoUtil.FESTIVAL[this.getMonth()+'-'+this.getDay()];
|
|
|
|
|
if(fs){
|
|
|
|
|
l=l.concat(fs);
|
|
|
|
|
}
|
|
|
|
|
var jq = this._p.lunar.getJieQi();
|
|
|
|
|
if('冬至'===jq){
|
|
|
|
|
l.push(TaoFestival.create('元始天尊圣诞'));
|
|
|
|
|
}else if('夏至'===jq){
|
|
|
|
|
l.push(TaoFestival.create('灵宝天尊圣诞'));
|
|
|
|
|
}
|
|
|
|
|
var f = TaoUtil.BA_JIE[jq];
|
|
|
|
|
if(f){
|
|
|
|
|
l.push(TaoFestival.create(f));
|
|
|
|
|
}
|
|
|
|
|
f = TaoUtil.BA_HUI[this._p.lunar.getDayInGanZhi()];
|
|
|
|
|
if(f){
|
|
|
|
|
l.push(TaoFestival.create(f));
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
},
|
|
|
|
|
_isDayIn:function(days){
|
|
|
|
|
var md = this.getMonth() + '-' + this.getDay();
|
|
|
|
|
for(var i=0,j=days.length;i<j;i++){
|
|
|
|
|
if(md===days[i]){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
isDaySanHui:function(){return this._isDayIn(TaoUtil.SAN_HUI);},
|
|
|
|
|
isDaySanYuan:function(){return this._isDayIn(TaoUtil.SAN_YUAN);},
|
|
|
|
|
isDayBaJie:function(){return !!TaoUtil.BA_JIE[this._p.lunar.getJieQi()];},
|
|
|
|
|
isDayWuLa:function(){return this._isDayIn(TaoUtil.WU_LA);},
|
|
|
|
|
isDayBaHui:function(){return !!TaoUtil.BA_HUI[this._p.lunar.getDayInGanZhi()];},
|
|
|
|
|
isDayMingWu:function(){return '戊'===this._p.lunar.getDayGan();},
|
|
|
|
|
isDayAnWu:function(){return this._p.lunar.getDayZhi()===TaoUtil.AN_WU[Math.abs(this.getMonth())-1]},
|
|
|
|
|
isDayWu:function(){return this.isDayMingWu()||this.isDayAnWu()},
|
|
|
|
|
isDayTianShe:function(){
|
|
|
|
|
var ret = false;
|
|
|
|
|
var mz = this._p.lunar.getMonthZhi();
|
|
|
|
|
var dgz = this._p.lunar.getDayInGanZhi();
|
|
|
|
|
switch (mz) {
|
|
|
|
|
case '寅':
|
|
|
|
|
case '卯':
|
|
|
|
|
case '辰':
|
|
|
|
|
if ('戊寅' === dgz) {
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '巳':
|
|
|
|
|
case '午':
|
|
|
|
|
case '未':
|
|
|
|
|
if ('甲午' === dgz) {
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '申':
|
|
|
|
|
case '酉':
|
|
|
|
|
case '戌':
|
|
|
|
|
if ('戊申' === dgz) {
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '亥':
|
|
|
|
|
case '子':
|
|
|
|
|
case '丑':
|
|
|
|
|
if ('甲子' === dgz) {
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
},
|
|
|
|
|
toString:function(){
|
|
|
|
|
return this.getYearInChinese()+'年'+this.getMonthInChinese()+'月'+this.getDayInChinese();
|
|
|
|
|
},
|
|
|
|
|
toFullString:function(){
|
|
|
|
|
return '道歷'+this.getYearInChinese()+'年,天運'+this._p.lunar.getYearInGanZhi()+'年,'+this._p.lunar.getMonthInGanZhi()+'月,'+this._p.lunar.getDayInGanZhi()+'日。'+this.getMonthInChinese()+'月'+this.getDayInChinese()+'日,'+this._p.lunar.getTimeZhi()+'時。';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
BIRTH_YEAR:-2697,
|
|
|
|
|
fromYmdHms:function(y,m,d,hour,minute,second){return _fromYmdHms(y,m,d,hour,minute,second);},
|
|
|
|
|
fromYmd:function(y,m,d){return _fromYmdHms(y,m,d,0,0,0);},
|
|
|
|
|
fromLunar:function(lunar){return _fromLunar(lunar);}
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
return {
|
|
|
|
|
ShouXingUtil:ShouXingUtil,
|
|
|
|
|
SolarUtil:SolarUtil,
|
|
|
|
|
LunarUtil:LunarUtil,
|
|
|
|
|
FotoUtil:FotoUtil,
|
|
|
|
|
TaoUtil:TaoUtil,
|
|
|
|
|
Solar:Solar,
|
|
|
|
|
Lunar:Lunar,
|
|
|
|
|
Foto:Foto,
|
|
|
|
|
Tao:Tao,
|
|
|
|
|
NineStar:NineStar,
|
|
|
|
|
EightChar:EightChar,
|
|
|
|
|
SolarWeek:SolarWeek,
|
|
|
|
|
SolarMonth:SolarMonth,
|
|
|
|
|
SolarSeason:SolarSeason,
|
|
|
|
|
SolarHalfYear:SolarHalfYear,
|
|
|
|
|
SolarYear:SolarYear,
|
|
|
|
|
LunarMonth:LunarMonth,
|
|
|
|
|
LunarYear:LunarYear,
|
|
|
|
|
LunarTime:LunarTime,
|
|
|
|
|
HolidayUtil:HolidayUtil
|
|
|
|
|
};
|
|
|
|
|
});
|