Skip to content

Commit

Permalink
v1.2.6 新增治水、分饼、耕田、得金、日禄;新增时辰LunarTime;新增获取当天的所有时辰。
Browse files Browse the repository at this point in the history
  • Loading branch information
6tail committed Oct 13, 2021
1 parent 2694429 commit fc0a629
Show file tree
Hide file tree
Showing 10 changed files with 564 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)和农历(阴历、老黄历)
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.5</version>
<version>1.2.6</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.5</version>
<version>1.2.6</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<packaging>jar</packaging>
<version>1.2.5</version>
<version>1.2.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>
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/nlf/calendar/Lunar.java
Original file line number Diff line number Diff line change
Expand Up @@ -2604,4 +2604,42 @@ public String getWuHou() {
int days = (int) ((currentCalendar.getTimeInMillis() - startCalendar.getTimeInMillis()) / MS_PER_DAY);
return LunarUtil.WU_HOU[(offset * 3 + days / 5) % LunarUtil.WU_HOU.length];
}

/**
* 获取日禄
* @return 日禄
*/
public String getDayLu() {
String gan = LunarUtil.LU.get(getDayGan());
String zhi = LunarUtil.LU.get(getDayZhi());
String lu = gan + "命互禄";
if (null != zhi) {
lu += " " + zhi + "命进禄";
}
return lu;
}

/**
* 获取时辰
*
* @return 时辰
*/
public LunarTime getTime() {
return new LunarTime(year, month, day, hour, minute, second);
}

/**
* 获取当天的时辰列表
*
* @return 时辰列表
*/
public List<LunarTime> getTimes() {
List<LunarTime> l = new ArrayList<LunarTime>();
l.add(new LunarTime(year, month, day, 0, 0, 0));
for(int i = 0; i < 12; i++){
l.add(new LunarTime(year, month, day, (i+1)*2-1, 0, 0));
}
return l;
}

}
Loading

0 comments on commit fc0a629

Please sign in to comment.