Skip to content

Commit

Permalink
v1.2.11 修正胎神数据;增加福神流派。
Browse files Browse the repository at this point in the history
  • Loading branch information
6tail committed Nov 15, 2021
1 parent 50e8bdd commit ee2d381
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 15 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.10</version>
<version>1.2.11</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.10</version>
<version>1.2.11</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.10</version>
<version>1.2.11</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
28 changes: 24 additions & 4 deletions src/main/java/com/nlf/calendar/Lunar.java
Original file line number Diff line number Diff line change
Expand Up @@ -1178,12 +1178,22 @@ public String getDayPositionFu(int sect) {
}

/**
* 获取日福神方位描述
* 获取日福神方位描述(默认流派:2)
*
* @return 福神方位描述,如东北
*/
public String getDayPositionFuDesc() {
return LunarUtil.POSITION_DESC.get(getDayPositionFu());
return getDayPositionFuDesc(2);
}

/**
* 获取日福神方位描述
*
* @param sect 流派,1或2
* @return 福神方位描述,如东北
*/
public String getDayPositionFuDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getDayPositionFu(sect));
}

/**
Expand Down Expand Up @@ -1278,12 +1288,22 @@ public String getTimePositionFu(int sect) {
}

/**
* 获取时辰福神方位描述
* 获取时辰福神方位描述,默认流派2
*
* @return 福神方位描述,如东北
*/
public String getTimePositionFuDesc() {
return LunarUtil.POSITION_DESC.get(getTimePositionFu());
return getTimePositionFuDesc(2);
}

/**
* 获取时辰福神方位描述
*
* @param sect 流派,1或2
* @return 福神方位描述,如东北
*/
public String getTimePositionFuDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getTimePositionFu(sect));
}

/**
Expand Down
36 changes: 28 additions & 8 deletions src/main/java/com/nlf/calendar/LunarTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,41 @@ public String getPositionYinGuiDesc() {
}

/**
* 获取福神方位
* 获取福神方位(默认流派:2)
*
* @return 福神方位,如艮
*/
public String getPositionFu() {
return LunarUtil.POSITION_FU[ganIndex + 1];
return getPositionFu(2);
}

/**
* 获取福神方位描述
* 获取福神方位
*
* @param sect 流派,1或2
* @return 福神方位,如艮
*/
public String getPositionFu(int sect) {
return (1 == sect ? LunarUtil.POSITION_FU : LunarUtil.POSITION_FU_2)[ganIndex + 1];
}

/**
* 获取福神方位描述(默认流派:2)
*
* @return 福神方位描述,如东北
*/
public String getPositionFuDesc() {
return LunarUtil.POSITION_DESC.get(getPositionFu());
return getPositionFuDesc(2);
}

/**
* 获取福神方位描述
*
* @param sect 流派,1或2
* @return 福神方位描述,如东北
*/
public String getPositionFuDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getPositionFu(sect));
}

/**
Expand Down Expand Up @@ -342,12 +362,12 @@ public String getXunKong() {
*/
public String getMinHm() {
int hour = lunar.getHour();
if (hour <1){
if (hour < 1) {
return "00:00";
} else if (hour > 22) {
return "23:00";
}
return String.format("%02d:00", hour % 2 == 0? hour - 1 : hour);
return String.format("%02d:00", hour % 2 == 0 ? hour - 1 : hour);
}

/**
Expand All @@ -357,12 +377,12 @@ public String getMinHm() {
*/
public String getMaxHm() {
int hour = lunar.getHour();
if (hour <1){
if (hour < 1) {
return "00:59";
} else if (hour > 22) {
return "23:59";
}
return String.format("%02d:59", hour % 2 == 0? hour : hour + 1);
return String.format("%02d:59", hour % 2 == 0 ? hour : hour + 1);
}

@Override
Expand Down

0 comments on commit ee2d381

Please sign in to comment.