Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9756d126d2 | ||
|
|
c7e769cbce | ||
|
|
dcd102d5b1 |
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.6tail</groupId>
|
<groupId>cn.6tail</groupId>
|
||||||
<artifactId>lunar</artifactId>
|
<artifactId>lunar</artifactId>
|
||||||
<version>1.2.20</version>
|
<version>1.2.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.6tail</groupId>
|
<groupId>cn.6tail</groupId>
|
||||||
<artifactId>lunar</artifactId>
|
<artifactId>lunar</artifactId>
|
||||||
<version>1.2.20</version>
|
<version>1.2.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
<groupId>cn.6tail</groupId>
|
<groupId>cn.6tail</groupId>
|
||||||
<artifactId>lunar</artifactId>
|
<artifactId>lunar</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.2.20</version>
|
<version>1.2.21</version>
|
||||||
<name>${project.groupId}:${project.artifactId}</name>
|
<name>${project.groupId}:${project.artifactId}</name>
|
||||||
<url>https://github.com/6tail/lunar-java</url>
|
<url>https://github.com/6tail/lunar-java</url>
|
||||||
<description>a calendar library for Solar and Chinese Lunar</description>
|
<description>a calendar library for Solar and Chinese Lunar</description>
|
||||||
|
|||||||
@@ -1828,21 +1828,41 @@ public class Lunar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取每日宜,如果没有,返回["无"]
|
* 使用默认流派1(以节交接当天起算月)获取每日宜,如果没有,返回["无"]
|
||||||
*
|
*
|
||||||
* @return 宜
|
* @return 宜
|
||||||
*/
|
*/
|
||||||
public List<String> getDayYi() {
|
public List<String> getDayYi() {
|
||||||
return LunarUtil.getDayYi(getMonthInGanZhiExact(), getDayInGanZhi());
|
return getDayYi(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取每日宜,如果没有,返回["无"]
|
||||||
|
*
|
||||||
|
* @param sect 流派,1以节交接当天起算月,2以节交接时刻起算月
|
||||||
|
* @return 宜
|
||||||
|
*/
|
||||||
|
public List<String> getDayYi(int sect) {
|
||||||
|
return LunarUtil.getDayYi(2 == sect ? getMonthInGanZhiExact() : getMonthInGanZhi(), getDayInGanZhi());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用默认流派1(以节交接当天起算月)获取每日忌,如果没有,返回["无"]
|
||||||
|
*
|
||||||
|
* @return 忌
|
||||||
|
*/
|
||||||
|
public List<String> getDayJi() {
|
||||||
|
return getDayJi(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取每日忌,如果没有,返回["无"]
|
* 获取每日忌,如果没有,返回["无"]
|
||||||
*
|
*
|
||||||
|
* @param sect 流派,1以节交接当天起算月,2以节交接时刻起算月
|
||||||
* @return 忌
|
* @return 忌
|
||||||
*/
|
*/
|
||||||
public List<String> getDayJi() {
|
public List<String> getDayJi(int sect) {
|
||||||
return LunarUtil.getDayJi(getMonthInGanZhiExact(), getDayInGanZhi());
|
return LunarUtil.getDayJi(2 == sect ? getMonthInGanZhiExact() : getMonthInGanZhi(), getDayInGanZhi());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -415,4 +415,13 @@ public class LunarTest {
|
|||||||
Assert.assertEquals("一九八六年七月初九", lunar.toString());
|
Assert.assertEquals("一九八六年七月初九", lunar.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test56() {
|
||||||
|
Solar solar = new Solar(2022, 4, 5);
|
||||||
|
Lunar lunar = solar.getLunar();
|
||||||
|
Assert.assertEquals("甲辰", lunar.getMonthInGanZhi());
|
||||||
|
Assert.assertEquals("癸卯", lunar.getMonthInGanZhiExact());
|
||||||
|
Assert.assertEquals(4, lunar.getDayJi().size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user