1
0
mirror of synced 2026-04-16 05:18:43 +08:00

Compare commits

..

1 Commits

Author SHA1 Message Date
6tail
a41d2c6c2a v1.2.34 修复春节和立春之间月干错误的问题。 2022-10-12 21:38:38 +08:00
4 changed files with 17 additions and 5 deletions

View File

@@ -168,3 +168,12 @@ test('身宫3', () => {
const eightChar = lunar.getEightChar();
expect(eightChar.getShenGong()).toBe('庚申');
});
test('test11', () => {
const lunar = Lunar.fromYmdHms(1987, 12, 28, 23, 30, 0);
const eightChar = lunar.getEightChar();
expect(eightChar.getYear()).toBe('戊辰');
expect(eightChar.getMonth()).toBe('甲寅');
expect(eightChar.getDay()).toBe('庚子');
expect(eightChar.getTime()).toBe('戊子');
});

View File

@@ -93,7 +93,7 @@ test('test7', () => {
test('test8', () => {
const lunar = Lunar.fromYmd(2050, 12, 1);
expect(lunar.getJieQiTable()['大雪'].toYmdHms()).toBe('2050-12-07 06:41:00');
expect(lunar.getJieQiTable()['DA_XUE'].toYmdHms()).toBe('2050-12-07 06:41:00');
});
test('test9', () => {

View File

@@ -567,6 +567,9 @@
}
var noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1);
var solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second);
if (noon.getYear() !== lunarYear) {
y = LunarYear.fromYear(noon.getYear());
}
return _new(lunarYear, lunarMonth, lunarDay, hour, minute, second, solar, y);
};
var _new = function(year,month,day,hour,minute,second,solar,ly){
@@ -1068,7 +1071,7 @@
if(f){
l.push(f);
}
if (Math.abs(this._p.month) === 12 && this._p.day >= 29 && this._p.year != this.next(1).getYear()) {
if (Math.abs(this._p.month) === 12 && this._p.day >= 29 && this._p.year !== this.next(1).getYear()) {
l.push('除夕');
}
return l;
@@ -1223,7 +1226,7 @@
_getYearNineStar:function(yearInGanZhi){
var index = LunarUtil.getJiaZiIndex(yearInGanZhi) + 1;
var yearOffset = 0;
if (index != LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1) {
if (index !== LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1) {
yearOffset = -1;
}
var yuan = Math.floor((this._p.year + yearOffset + 2696) / 60) % 3;
@@ -1377,7 +1380,7 @@
var j;
for(i=0,j=Lunar.JIE_QI.length;i<j;i++){
if(Lunar.JIE_QI[i]===name){
if(i%2==0){
if(i%2===0){
qi = true;
}else{
jie = true;

View File

@@ -1,6 +1,6 @@
{
"name": "lunar-javascript",
"version": "1.2.33",
"version": "1.2.34",
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
"main": "index.js",
"scripts": {