Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66d16db39e | ||
|
|
98fb502c02 | ||
|
|
44a2b408cf | ||
|
|
26557902f6 | ||
|
|
1e7f33e048 | ||
|
|
988d3f60a7 |
@@ -19,3 +19,21 @@ test('testFromSunday', () => {
|
|||||||
expect(week.getFirstDay().toString()).toBe('2019-04-28');
|
expect(week.getFirstDay().toString()).toBe('2019-04-28');
|
||||||
expect(week.getFirstDayInMonth().toString()).toBe('2019-05-01');
|
expect(week.getFirstDayInMonth().toString()).toBe('2019-05-01');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test1', () => {
|
||||||
|
const start = 0;
|
||||||
|
const week = SolarWeek.fromYmd(2022, 5, 1, start);
|
||||||
|
expect(week.getIndex()).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test2', () => {
|
||||||
|
const start = 2;
|
||||||
|
const week = SolarWeek.fromYmd(2021, 5, 4, start);
|
||||||
|
expect(week.getIndex()).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test3', () => {
|
||||||
|
const start = 0;
|
||||||
|
const week = SolarWeek.fromYmd(2022, 3, 6, start);
|
||||||
|
expect(week.getIndexInYear()).toBe(11);
|
||||||
|
});
|
||||||
|
|||||||
@@ -77,3 +77,9 @@ test('test13', () => {
|
|||||||
const lunar = solar.getLunar();
|
const lunar = solar.getLunar();
|
||||||
expect(lunar.getHou()).toBe('小寒 初候');
|
expect(lunar.getHou()).toBe('小寒 初候');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test14', () => {
|
||||||
|
const solar = Solar.fromYmd(2022,5,20);
|
||||||
|
const lunar = solar.getLunar();
|
||||||
|
expect(lunar.getHou()).toBe('立夏 三候');
|
||||||
|
});
|
||||||
|
|||||||
@@ -31,3 +31,30 @@ it('test3', () => {
|
|||||||
expect(yun.getStartDay()).toBe(0);
|
expect(yun.getStartDay()).toBe(0);
|
||||||
expect(yun.getStartSolar().toYmd()).toBe('2020-02-06');
|
expect(yun.getStartSolar().toYmd()).toBe('2020-02-06');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('test4', () => {
|
||||||
|
const solar = Solar.fromYmdHms(2022, 3, 9, 20, 51, 0);
|
||||||
|
const lunar = solar.getLunar();
|
||||||
|
const eightChar = lunar.getEightChar();
|
||||||
|
const yun = eightChar.getYun(1);
|
||||||
|
expect(yun.getStartSolar().toYmd()).toBe('2030-12-19');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('test5', () => {
|
||||||
|
const solar = Solar.fromYmdHms(2022, 3, 9, 20, 51, 0);
|
||||||
|
const lunar = solar.getLunar();
|
||||||
|
const eightChar = lunar.getEightChar();
|
||||||
|
const yun = eightChar.getYun(1, 2);
|
||||||
|
expect(yun.getStartYear()).toBe(8);
|
||||||
|
expect(yun.getStartMonth()).toBe(9);
|
||||||
|
expect(yun.getStartDay()).toBe(2);
|
||||||
|
expect(yun.getStartSolar().toYmd()).toBe('2030-12-12');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('test6', () => {
|
||||||
|
const solar = Solar.fromYmdHms(2018, 6, 11, 9, 30, 0);
|
||||||
|
const lunar = solar.getLunar();
|
||||||
|
const eightChar = lunar.getEightChar();
|
||||||
|
const yun = eightChar.getYun(0, 2);
|
||||||
|
expect(yun.getStartSolar().toYmd()).toBe('2020-03-21');
|
||||||
|
});
|
||||||
|
|||||||
243
lunar.js
243
lunar.js
@@ -983,59 +983,51 @@
|
|||||||
},
|
},
|
||||||
_convertJieQi:function(name){
|
_convertJieQi:function(name){
|
||||||
var jq = name;
|
var jq = name;
|
||||||
if('DONG_ZHI'===jq){
|
if('DONG_ZHI' === jq){
|
||||||
jq = '冬至';
|
jq = '冬至';
|
||||||
}else if('DA_HAN'===jq){
|
}else if('DA_HAN' === jq){
|
||||||
jq = '大寒';
|
jq = '大寒';
|
||||||
}else if('XIAO_HAN'===jq){
|
}else if('XIAO_HAN' === jq){
|
||||||
jq = '小寒';
|
jq = '小寒';
|
||||||
}else if('LI_CHUN'===jq){
|
}else if('LI_CHUN' === jq){
|
||||||
jq = '立春';
|
jq = '立春';
|
||||||
}else if('DA_XUE'===jq){
|
}else if('DA_XUE' === jq){
|
||||||
jq = '大雪';
|
jq = '大雪';
|
||||||
}else if('YU_SHUI'===jq){
|
}else if('YU_SHUI' === jq){
|
||||||
jq = '雨水';
|
jq = '雨水';
|
||||||
}else if('JING_ZHE'===jq){
|
}else if('JING_ZHE' === jq){
|
||||||
jq = '惊蛰';
|
jq = '惊蛰';
|
||||||
}
|
}
|
||||||
return jq;
|
return jq;
|
||||||
},
|
},
|
||||||
getJie:function(){
|
getJie:function(){
|
||||||
var d;
|
for(var i=0, j=Lunar.JIE_QI_IN_USE.length; i<j; i+=2){
|
||||||
var jie='';
|
|
||||||
for(var i=0,j=Lunar.JIE_QI_IN_USE.length;i<j;i+=2){
|
|
||||||
var key = Lunar.JIE_QI_IN_USE[i];
|
var key = Lunar.JIE_QI_IN_USE[i];
|
||||||
d = this._p.jieQi[key];
|
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()){
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
||||||
jie=key;
|
return this._convertJieQi(key);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._convertJieQi(jie);
|
return '';
|
||||||
},
|
},
|
||||||
getQi:function(){
|
getQi:function(){
|
||||||
var d;
|
for(var i=1, j=Lunar.JIE_QI_IN_USE.length; i<j; i+=2){
|
||||||
var qi='';
|
|
||||||
for(var i=1,j=Lunar.JIE_QI_IN_USE.length;i<j;i+=2){
|
|
||||||
var key = Lunar.JIE_QI_IN_USE[i];
|
var key = Lunar.JIE_QI_IN_USE[i];
|
||||||
d = this._p.jieQi[key];
|
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()){
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
||||||
qi=key;
|
return this._convertJieQi(key);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._convertJieQi(qi);
|
return '';
|
||||||
},
|
},
|
||||||
getJieQi:function(){
|
getJieQi:function(){
|
||||||
var name = '';
|
|
||||||
for(var key in this._p.jieQi){
|
for(var key in this._p.jieQi){
|
||||||
var d = this._p.jieQi[key];
|
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()){
|
if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){
|
||||||
name = key;
|
return this._convertJieQi(key);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._convertJieQi(name);
|
return '';
|
||||||
},
|
},
|
||||||
getWeek:function(){
|
getWeek:function(){
|
||||||
return this._p.weekIndex;
|
return this._p.weekIndex;
|
||||||
@@ -1182,11 +1174,11 @@
|
|||||||
}
|
}
|
||||||
return LunarUtil.POSITION_TAI_MONTH[m-1];
|
return LunarUtil.POSITION_TAI_MONTH[m-1];
|
||||||
},
|
},
|
||||||
getDayYi:function(){
|
getDayYi:function(sect){
|
||||||
return LunarUtil.getDayYi(this.getMonthInGanZhiExact(),this.getDayInGanZhi());
|
return LunarUtil.getDayYi(2 == sect ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(), this.getDayInGanZhi());
|
||||||
},
|
},
|
||||||
getDayJi:function(){
|
getDayJi:function(sect){
|
||||||
return LunarUtil.getDayJi(this.getMonthInGanZhiExact(),this.getDayInGanZhi());
|
return LunarUtil.getDayJi(2 == sect ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(), this.getDayInGanZhi());
|
||||||
},
|
},
|
||||||
getDayJiShen:function(){
|
getDayJiShen:function(){
|
||||||
return LunarUtil.getDayJiShen(this.getMonth(),this.getDayInGanZhi());
|
return LunarUtil.getDayJiShen(this.getMonth(),this.getDayInGanZhi());
|
||||||
@@ -1429,16 +1421,33 @@
|
|||||||
return this._buildJieQi(name, near);
|
return this._buildJieQi(name, near);
|
||||||
},
|
},
|
||||||
getCurrentJieQi:function(){
|
getCurrentJieQi:function(){
|
||||||
var name = this.getJieQi();
|
for(var key in this._p.jieQi){
|
||||||
return name.length>0 ? this._buildJieQi(name,this.solar) : null;
|
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(){
|
getCurrentJie:function(){
|
||||||
var name = this.getJie();
|
for(var i=0, j=Lunar.JIE_QI_IN_USE.length; i<j; i+=2){
|
||||||
return name.length>0 ? this._buildJieQi(name,this.solar) : null;
|
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(){
|
getCurrentQi:function(){
|
||||||
var name = this.getQi();
|
for(var i=1, j=Lunar.JIE_QI_IN_USE.length; i<j; i+=2){
|
||||||
return name.length>0 ? this._buildJieQi(name,this.solar) : null;
|
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(){
|
getEightChar:function(){
|
||||||
if(!this._p.eightChar){
|
if(!this._p.eightChar){
|
||||||
@@ -1650,11 +1659,14 @@
|
|||||||
getHou:function(){
|
getHou:function(){
|
||||||
var jieQi = this.getPrevJieQi(true);
|
var jieQi = this.getPrevJieQi(true);
|
||||||
var name = jieQi.getName();
|
var name = jieQi.getName();
|
||||||
var currentCalendar = ExactDate.fromYmd(this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
|
||||||
var startSolar = jieQi.getSolar();
|
var startSolar = jieQi.getSolar();
|
||||||
var startCalendar = ExactDate.fromYmd(startSolar.getYear(),startSolar.getMonth(),startSolar.getDay());
|
var days = ExactDate.getDaysBetweenYmd(startSolar.getYear(),startSolar.getMonth(),startSolar.getDay(), this._p.solar.getYear(),this._p.solar.getMonth(),this._p.solar.getDay());
|
||||||
var days = days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
|
var max = LunarUtil.HOU.length - 1;
|
||||||
return name + ' ' + LunarUtil.HOU[(Math.floor(days/5)) % LunarUtil.HOU.length];
|
var offset = Math.floor(days / 5);
|
||||||
|
if (offset > max) {
|
||||||
|
offset = max;
|
||||||
|
}
|
||||||
|
return name + ' ' + LunarUtil.HOU[offset];
|
||||||
},
|
},
|
||||||
getDayLu:function(){
|
getDayLu:function(){
|
||||||
var gan = LunarUtil.LU[this.getDayGan()];
|
var gan = LunarUtil.LU[this.getDayGan()];
|
||||||
@@ -1717,10 +1729,24 @@
|
|||||||
getIndex:function(){
|
getIndex:function(){
|
||||||
var firstDate = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
var firstDate = ExactDate.fromYmd(this._p.year,this._p.month,1);
|
||||||
var firstDayWeek = firstDate.getDay();
|
var firstDayWeek = firstDate.getDay();
|
||||||
if(firstDayWeek===0){
|
var offset = firstDayWeek - this._p.start;
|
||||||
firstDayWeek = 7;
|
if(offset < 0) {
|
||||||
|
offset += 7;
|
||||||
}
|
}
|
||||||
return Math.ceil((this._p.day+firstDayWeek-this._p.start)/7);
|
return Math.ceil((this._p.day + offset)/7);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取当前日期是在当年第几周
|
||||||
|
* @return number 周序号,从1开始
|
||||||
|
*/
|
||||||
|
getIndexInYear:function(){
|
||||||
|
var firstDate = ExactDate.fromYmd(this._p.year, 1, 1);
|
||||||
|
var firstDayWeek = firstDate.getDay();
|
||||||
|
var offset = firstDayWeek - this._p.start;
|
||||||
|
if(offset < 0) {
|
||||||
|
offset += 7;
|
||||||
|
}
|
||||||
|
return Math.ceil((SolarUtil.getDaysInYear(this._p.year, this._p.month, this._p.day) + offset)/7);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 周推移
|
* 周推移
|
||||||
@@ -2258,6 +2284,9 @@
|
|||||||
toFullString:function(){
|
toFullString:function(){
|
||||||
return this.getYear()+'年';
|
return this.getYear()+'年';
|
||||||
},
|
},
|
||||||
|
next:function(n){
|
||||||
|
return LunarYear.fromYear(this._p.year + n);
|
||||||
|
},
|
||||||
_compute:function(){
|
_compute:function(){
|
||||||
this._p.months = [];
|
this._p.months = [];
|
||||||
this._p.jieQiJulianDays = [];
|
this._p.jieQiJulianDays = [];
|
||||||
@@ -2412,6 +2441,65 @@
|
|||||||
var offset = (n - monthZhiIndex) % 9;
|
var offset = (n - monthZhiIndex) % 9;
|
||||||
return NineStar.fromIndex(offset);
|
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()+')天';}
|
toString:function(){return this.getYear()+'年'+(this.isLeap()?'闰':'')+LunarUtil.MONTH[Math.abs(this.getMonth())]+'月('+this.getDayCount()+')天';}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -3445,7 +3533,8 @@
|
|||||||
},
|
},
|
||||||
getShenGongNaYin:function(){return LunarUtil.NAYIN[this.getShenGong()];},
|
getShenGongNaYin:function(){return LunarUtil.NAYIN[this.getShenGong()];},
|
||||||
getLunar:function(){return this._p.lunar;},
|
getLunar:function(){return this._p.lunar;},
|
||||||
getYun:function(gender){
|
getYun:function(gender, sect){
|
||||||
|
sect = (2 == sect) ? sect : 1;
|
||||||
var lunar = this.getLunar();
|
var lunar = this.getLunar();
|
||||||
var yang = 0 === lunar.getYearGanIndexExact() % 2;
|
var yang = 0 === lunar.getYearGanIndexExact() % 2;
|
||||||
var man = 1 === gender;
|
var man = 1 === gender;
|
||||||
@@ -3456,27 +3545,44 @@
|
|||||||
var current = lunar.getSolar();
|
var current = lunar.getSolar();
|
||||||
var start = forward ? current : prev.getSolar();
|
var start = forward ? current : prev.getSolar();
|
||||||
var end = forward ? next.getSolar() : current;
|
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 year;
|
||||||
// 时辰差
|
var month;
|
||||||
var hourDiff = endTimeZhiIndex - startTimeZhiIndex;
|
var day;
|
||||||
var endCalendar = ExactDate.fromYmd(end.getYear(), end.getMonth(), end.getDay());
|
var hour = 0;
|
||||||
var startCalendar = ExactDate.fromYmd(start.getYear(), start.getMonth(), start.getDay());
|
|
||||||
// 天数差
|
if (2 === sect) {
|
||||||
var dayDiff = Math.floor((endCalendar - startCalendar) / (1000 * 3600 * 24));
|
var minutes = Math.floor((end.getCalendar() - start.getCalendar()) / 60000);
|
||||||
if (hourDiff < 0) {
|
year = Math.floor(minutes / 4320);
|
||||||
hourDiff += 12;
|
minutes -= year * 4320;
|
||||||
dayDiff--;
|
month = Math.floor(minutes / 360);
|
||||||
|
minutes -= month * 360;
|
||||||
|
day = Math.floor(minutes / 12);
|
||||||
|
minutes -= day * 12;
|
||||||
|
hour = minutes * 2;
|
||||||
|
} else {
|
||||||
|
var endTimeZhiIndex = (end.getHour() === 23) ? 11 : LunarUtil.getTimeZhiIndex(end.toYmdHms().substr(11, 5));
|
||||||
|
var 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);
|
||||||
|
month = dayDiff * 4 + monthDiff;
|
||||||
|
day = hourDiff * 10 - monthDiff * 30;
|
||||||
|
year = Math.floor(month / 12);
|
||||||
|
month = month - year * 12;
|
||||||
}
|
}
|
||||||
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 {
|
return {
|
||||||
year: year,
|
year: year,
|
||||||
month: month,
|
month: month,
|
||||||
day: day
|
day: day,
|
||||||
|
hour: hour
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
var buildLiuYue = function(liuNian, index){
|
var buildLiuYue = function(liuNian, index){
|
||||||
@@ -3656,6 +3762,7 @@
|
|||||||
startYear: start.year,
|
startYear: start.year,
|
||||||
startMonth: start.month,
|
startMonth: start.month,
|
||||||
startDay: start.day,
|
startDay: start.day,
|
||||||
|
startHour: start.hour,
|
||||||
forward: forward,
|
forward: forward,
|
||||||
lunar: lunar
|
lunar: lunar
|
||||||
},
|
},
|
||||||
@@ -3663,6 +3770,7 @@
|
|||||||
getStartYear: function(){return this._p.startYear;},
|
getStartYear: function(){return this._p.startYear;},
|
||||||
getStartMonth: function(){return this._p.startMonth;},
|
getStartMonth: function(){return this._p.startMonth;},
|
||||||
getStartDay: function(){return this._p.startDay;},
|
getStartDay: function(){return this._p.startDay;},
|
||||||
|
getStartHour: function(){return this._p.startHour;},
|
||||||
isForward: function(){return this._p.forward;},
|
isForward: function(){return this._p.forward;},
|
||||||
getLunar: function(){return this._p.lunar;},
|
getLunar: function(){return this._p.lunar;},
|
||||||
getStartSolar: function(){
|
getStartSolar: function(){
|
||||||
@@ -3671,6 +3779,7 @@
|
|||||||
c.setFullYear(birth.getYear() + this._p.startYear);
|
c.setFullYear(birth.getYear() + this._p.startYear);
|
||||||
c.setMonth(birth.getMonth()-1+this._p.startMonth);
|
c.setMonth(birth.getMonth()-1+this._p.startMonth);
|
||||||
c.setDate(birth.getDay() + this._p.startDay);
|
c.setDate(birth.getDay() + this._p.startDay);
|
||||||
|
c.setHours(birth.getHour() + this._p.startHour);
|
||||||
return Solar.fromDate(c);
|
return Solar.fromDate(c);
|
||||||
},
|
},
|
||||||
getDaYun: function(n){
|
getDaYun: function(n){
|
||||||
@@ -4241,7 +4350,7 @@
|
|||||||
'冬至':'北方玄上玉宸天尊同黑帝五炁天君下降'
|
'冬至':'北方玄上玉宸天尊同黑帝五炁天君下降'
|
||||||
},
|
},
|
||||||
FESTIVAL: {
|
FESTIVAL: {
|
||||||
'1-1': [_f('天腊之辰', '天腊,此日五帝会于束方九炁青天')],
|
'1-1': [_f('天腊之辰', '天腊,此日五帝会于东方九炁青天')],
|
||||||
'1-3': [_f('郝真人圣诞'), _f('孙真人圣诞')],
|
'1-3': [_f('郝真人圣诞'), _f('孙真人圣诞')],
|
||||||
'1-5': [_f('孙祖清静元君诞')],
|
'1-5': [_f('孙祖清静元君诞')],
|
||||||
'1-7': [_f('举迁赏会', '此日上元赐福,天官同地水二官考校罪福')],
|
'1-7': [_f('举迁赏会', '此日上元赐福,天官同地水二官考校罪福')],
|
||||||
@@ -4276,7 +4385,7 @@
|
|||||||
'4-20': [_f('眼光圣母娘娘诞')],
|
'4-20': [_f('眼光圣母娘娘诞')],
|
||||||
'4-28': [_f('神农先帝诞')],
|
'4-28': [_f('神农先帝诞')],
|
||||||
'5-1': [_f('南极长生大帝圣诞')],
|
'5-1': [_f('南极长生大帝圣诞')],
|
||||||
'5-5': [_f('地腊之辰', '地腊,此日五帝会於南方三炁丹天'), _f('南方雷祖圣诞'), _f('地祗温元帅圣诞'), _f('雷霆邓天君圣诞')],
|
'5-5': [_f('地腊之辰', '地腊,此日五帝会于南方三炁丹天'), _f('南方雷祖圣诞'), _f('地祗温元帅圣诞'), _f('雷霆邓天君圣诞')],
|
||||||
'5-11': [_f('城隍爷圣诞')],
|
'5-11': [_f('城隍爷圣诞')],
|
||||||
'5-13': [_f('关圣帝君降神'), _f('关平太子圣诞')],
|
'5-13': [_f('关圣帝君降神'), _f('关平太子圣诞')],
|
||||||
'5-18': [_f('张天师圣诞')],
|
'5-18': [_f('张天师圣诞')],
|
||||||
@@ -4318,7 +4427,7 @@
|
|||||||
'9-22': [_f('增福财神诞')],
|
'9-22': [_f('增福财神诞')],
|
||||||
'9-23': [_f('萨翁真君圣诞')],
|
'9-23': [_f('萨翁真君圣诞')],
|
||||||
'9-28': [_f('五显灵官马元帅圣诞')],
|
'9-28': [_f('五显灵官马元帅圣诞')],
|
||||||
'10-1': [_f('民岁腊之辰', '民岁腊,此日五帝会於北方五炁黑天'), _f('东皇大帝圣诞')],
|
'10-1': [_f('民岁腊之辰', '民岁腊,此日五帝会于北方五炁黑天'), _f('东皇大帝圣诞')],
|
||||||
'10-3': [_f('三茅应化真君圣诞')],
|
'10-3': [_f('三茅应化真君圣诞')],
|
||||||
'10-6': [_f('天曹诸司五岳五帝圣诞')],
|
'10-6': [_f('天曹诸司五岳五帝圣诞')],
|
||||||
'10-15': [_f('下元水官大帝圣诞'), _f('建生大会', '此日下元解厄,水官同天地二官考校罪福')],
|
'10-15': [_f('下元水官大帝圣诞'), _f('建生大会', '此日下元解厄,水官同天地二官考校罪福')],
|
||||||
@@ -4329,7 +4438,7 @@
|
|||||||
'11-9': [_f('湘子韩祖圣诞')],
|
'11-9': [_f('湘子韩祖圣诞')],
|
||||||
'11-11': [_f('太乙救苦天尊圣诞')],
|
'11-11': [_f('太乙救苦天尊圣诞')],
|
||||||
'11-26': [_f('北方五道圣诞')],
|
'11-26': [_f('北方五道圣诞')],
|
||||||
'12-8': [_f('王侯腊之辰', '王侯腊,此日五帝会於上方玄都玉京')],
|
'12-8': [_f('王侯腊之辰', '王侯腊,此日五帝会于上方玄都玉京')],
|
||||||
'12-16': [_f('南岳大帝圣诞'), _f('福德正神诞')],
|
'12-16': [_f('南岳大帝圣诞'), _f('福德正神诞')],
|
||||||
'12-20': [_f('鲁班先师圣诞')],
|
'12-20': [_f('鲁班先师圣诞')],
|
||||||
'12-21': [_f('天猷上帝圣诞')],
|
'12-21': [_f('天猷上帝圣诞')],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lunar-javascript",
|
"name": "lunar-javascript",
|
||||||
"version": "1.2.23",
|
"version": "1.2.29",
|
||||||
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
|
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user