v1.2.25 修复春节和立春之间月干错误的问题。
This commit is contained in:
@@ -183,6 +183,9 @@ public class Lunar {
|
||||
this.second = second;
|
||||
Solar noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1);
|
||||
this.solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second);
|
||||
if (noon.getYear() != lunarYear) {
|
||||
y = LunarYear.fromYear(noon.getYear());
|
||||
}
|
||||
compute(y);
|
||||
}
|
||||
|
||||
|
||||
@@ -276,4 +276,23 @@ public class BaZiTest {
|
||||
Assert.assertEquals("1990-04-15", lunar.getEightChar().getYun(1).getStartSolar().toYmd());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test10(){
|
||||
Lunar lunar = Solar.fromYmdHms(1988, 2, 15, 23, 30, 0).getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
|
||||
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
|
||||
Assert.assertEquals("日柱", "庚子", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "戊子", eightChar.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test11(){
|
||||
Lunar lunar = Lunar.fromYmdHms(1987, 12, 28, 23, 30, 0);
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
|
||||
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
|
||||
Assert.assertEquals("日柱", "庚子", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "戊子", eightChar.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class JieQiTest {
|
||||
@Test
|
||||
public void test8() {
|
||||
Lunar lunar = Lunar.fromYmd(2050, 12, 1);
|
||||
Assert.assertEquals("2050-12-07 06:41:00", lunar.getJieQiTable().get("大雪").toYmdHms());
|
||||
Assert.assertEquals("2050-12-07 06:41:00", lunar.getJieQiTable().get("DA_XUE").toYmdHms());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user