v1.7.6 修复候的错别字;修复吉神宜驱、凶神宜忌的错误;修复农历闰月及后续月份的干支错误。
This commit is contained in:
@@ -40,7 +40,12 @@
|
||||
## [1.7.4] - 2025-04-29
|
||||
1. 修复身宫报错的问题。
|
||||
|
||||
## [1.7.5] - 2025-09-17
|
||||
## [1.7.5] - 2025-10-01
|
||||
1. 修复:极端情况下八字转公历时刻出现遗漏的问题。
|
||||
2. 优化:更新△T参数。
|
||||
3. 优化:吉神宜驱、凶神宜忌。
|
||||
|
||||
## [1.7.6] - 2025-10-21
|
||||
1. 修复:候的错别字。
|
||||
2. 修复:吉神宜驱、凶神宜忌的错误。
|
||||
3. 修复:农历闰月及后续月份的干支错误。
|
||||
|
||||
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.7.5</version>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.7.5</version>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.7.5</version>
|
||||
<version>1.7.6</version>
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
<url>https://github.com/6tail/lunar-java</url>
|
||||
<description>a calendar library for Solar and Chinese Lunar</description>
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LunarMonth {
|
||||
this.dayCount = dayCount;
|
||||
this.firstJulianDay = firstJulianDay;
|
||||
this.index = index;
|
||||
this.zhiIndex = (index - 1 + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12;
|
||||
this.zhiIndex = (Math.abs(lunarMonth) - 1 + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ public class LunarMonth {
|
||||
|
||||
public int getGanIndex() {
|
||||
int offset = (LunarYear.fromYear(year).getGanIndex() + 1) % 5 * 2;
|
||||
return (index - 1 + offset) % 10;
|
||||
return (Math.abs(month) - 1 + offset) % 10;
|
||||
}
|
||||
|
||||
public String getGan() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class LunarUtil{
|
||||
/** 候 */
|
||||
public static final String[] HOU = {"初候", "二候", "三候"};
|
||||
/** 物候 */
|
||||
public static final String[] WU_HOU = {"蚯蚓结","麋角解","水泉动","雁北乡","鹊始巢","雉始雊","鸡始乳","征鸟厉疾","水泽腹坚","东风解冻","蛰虫始振","鱼陟负冰","獭祭鱼","候雁北","草木萌动","桃始华","仓庚鸣","鹰化为鸠","玄鸟至","雷乃发声","始电","桐始华","田鼠化为鴽","虹始见","萍始生","鸣鸠拂奇羽","戴胜降于桑","蝼蝈鸣","蚯蚓出","王瓜生","苦菜秀","靡草死","麦秋至","螳螂生","鵙始鸣","反舌无声","鹿角解","蜩始鸣","半夏生","温风至","蟋蟀居壁","鹰始挚","腐草为萤","土润溽暑","大雨行时","凉风至","白露降","寒蝉鸣","鹰乃祭鸟","天地始肃","禾乃登","鸿雁来","玄鸟归","群鸟养羞","雷始收声","蛰虫坯户","水始涸","鸿雁来宾","雀入大水为蛤","菊有黄花","豺乃祭兽","草木黄落","蛰虫咸俯","水始冰","地始冻","雉入大水为蜃","虹藏不见","天气上升地气下降","闭塞而成冬","鹖鴠不鸣","虎始交","荔挺出"};
|
||||
public static final String[] WU_HOU = {"蚯蚓结","麋角解","水泉动","雁北乡","鹊始巢","雉始雊","鸡始乳","征鸟厉疾","水泽腹坚","东风解冻","蛰虫始振","鱼陟负冰","獭祭鱼","候雁北","草木萌动","桃始华","仓庚鸣","鹰化为鸠","玄鸟至","雷乃发声","始电","桐始华","田鼠化为鴽","虹始见","萍始生","鸣鸠拂其羽","戴胜降于桑","蝼蝈鸣","蚯蚓出","王瓜生","苦菜秀","靡草死","麦秋至","螳螂生","鵙始鸣","反舌无声","鹿角解","蜩始鸣","半夏生","温风至","蟋蟀居壁","鹰始挚","腐草为萤","土润溽暑","大雨行时","凉风至","白露降","寒蝉鸣","鹰乃祭鸟","天地始肃","禾乃登","鸿雁来","玄鸟归","群鸟养羞","雷始收声","蛰虫坯户","水始涸","鸿雁来宾","雀入大水为蛤","菊有黄花","豺乃祭兽","草木黄落","蛰虫咸俯","水始冰","地始冻","雉入大水为蜃","虹藏不见","天气上升地气下降","闭塞而成冬","鹖鴠不鸣","虎始交","荔挺出"};
|
||||
/** 天干 */
|
||||
public static final String[] GAN = {"","甲","乙","丙","丁","戊","己","庚","辛","壬","癸"};
|
||||
/** 喜神方位,《喜神方位歌》:甲己在艮乙庚乾,丙辛坤位喜神安。丁壬只在离宫坐,戊癸原在在巽间。 */
|
||||
@@ -893,7 +893,7 @@ public class LunarUtil{
|
||||
List<String> l = new ArrayList<String>();
|
||||
int m = monthZhiIndex - 2;
|
||||
if (m < 0) {
|
||||
m += 10;
|
||||
m += 12;
|
||||
}
|
||||
Matcher matcher = Pattern.compile(String.format(";%02X(.[^;]*)", getJiaZiIndex(dayGanZhi))).matcher(DAY_SHEN_SHA[m]);
|
||||
if (matcher.find()) {
|
||||
@@ -921,7 +921,7 @@ public class LunarUtil{
|
||||
List<String> l = new ArrayList<String>();
|
||||
int m = monthZhiIndex - 2;
|
||||
if (m < 0) {
|
||||
m += 10;
|
||||
m += 12;
|
||||
}
|
||||
Matcher matcher = Pattern.compile(String.format(";%02X(.[^;]*)", getJiaZiIndex(dayGanZhi))).matcher(DAY_SHEN_SHA[m]);
|
||||
if (matcher.find()) {
|
||||
|
||||
@@ -22,14 +22,14 @@ public class LunarMonthTest {
|
||||
public void test1(){
|
||||
LunarMonth month = LunarMonth.fromYm(2023, -2);
|
||||
Assert.assertEquals(3, month.getIndex());
|
||||
Assert.assertEquals("丙辰", month.getGanZhi());
|
||||
Assert.assertEquals("乙卯", month.getGanZhi());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2(){
|
||||
LunarMonth month = LunarMonth.fromYm(2023, 3);
|
||||
Assert.assertEquals(4, month.getIndex());
|
||||
Assert.assertEquals("丁巳", month.getGanZhi());
|
||||
Assert.assertEquals("丙辰", month.getGanZhi());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -43,7 +43,7 @@ public class LunarMonthTest {
|
||||
public void test4(){
|
||||
LunarMonth month = LunarMonth.fromYm(2023, 12);
|
||||
Assert.assertEquals(13, month.getIndex());
|
||||
Assert.assertEquals("丙寅", month.getGanZhi());
|
||||
Assert.assertEquals("乙丑", month.getGanZhi());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -56,7 +56,7 @@ public class LunarMonthTest {
|
||||
@Test
|
||||
public void test6(){
|
||||
LunarMonth month = LunarMonth.fromYm(2023, 9);
|
||||
Assert.assertEquals("癸亥", month.getGanZhi());
|
||||
Assert.assertEquals("壬戌", month.getGanZhi());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -685,4 +685,12 @@ public class LunarTest {
|
||||
Assert.assertEquals("[时德, 阳德, 民日, 玉宇, 司命]", lunar.getDayJiShen().toString());
|
||||
Assert.assertEquals("[河魁, 死神, 天吏, 致死, 往亡]", lunar.getDayXiongSha().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test101() {
|
||||
Solar solar = new Solar(2025, 12, 15);
|
||||
Lunar lunar = solar.getLunar();
|
||||
Assert.assertEquals("[阳德, 六仪, 续世, 解神, 司命]", lunar.getDayJiShen().toString());
|
||||
Assert.assertEquals("[月破, 大耗, 灾煞, 天火, 厌对, 招摇, 五虚, 血忌]", lunar.getDayXiongSha().toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user