1
0
mirror of synced 2025-12-15 01:47:58 +08:00

v1.2.11 修正胎神数据;增加福神流派。

This commit is contained in:
6tail
2021-11-15 21:26:52 +08:00
parent 50e8bdd715
commit ee2d381fb7
5 changed files with 55 additions and 15 deletions

View File

@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)和农历(阴历、老黄历)
<dependency> <dependency>
<groupId>cn.6tail</groupId> <groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId> <artifactId>lunar</artifactId>
<version>1.2.10</version> <version>1.2.11</version>
</dependency> </dependency>
``` ```

View File

@@ -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.10</version> <version>1.2.11</version>
</dependency> </dependency>
``` ```

View File

@@ -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.10</version> <version>1.2.11</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>

View File

@@ -1178,12 +1178,22 @@ public class Lunar {
} }
/** /**
* 获取日福神方位描述 * 获取日福神方位描述默认流派2
* *
* @return 福神方位描述,如东北 * @return 福神方位描述,如东北
*/ */
public String getDayPositionFuDesc() { 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));
} }
/** /**
@@ -1278,12 +1288,22 @@ public class Lunar {
} }
/** /**
* 获取时辰福神方位描述 * 获取时辰福神方位描述默认流派2
* *
* @return 福神方位描述,如东北 * @return 福神方位描述,如东北
*/ */
public String getTimePositionFuDesc() { 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));
} }
/** /**

View File

@@ -136,21 +136,41 @@ public class LunarTime {
} }
/** /**
* 获取福神方位 * 获取福神方位默认流派2
* *
* @return 福神方位,如艮 * @return 福神方位,如艮
*/ */
public String getPositionFu() { 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 getPositionFuDesc(2);
} }
/** /**
* 获取福神方位描述 * 获取福神方位描述
* *
* @param sect 流派1或2
* @return 福神方位描述,如东北 * @return 福神方位描述,如东北
*/ */
public String getPositionFuDesc() { public String getPositionFuDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getPositionFu()); return LunarUtil.POSITION_DESC.get(getPositionFu(sect));
} }
/** /**
@@ -342,12 +362,12 @@ public class LunarTime {
*/ */
public String getMinHm() { public String getMinHm() {
int hour = lunar.getHour(); int hour = lunar.getHour();
if (hour <1){ if (hour < 1) {
return "00:00"; return "00:00";
} else if (hour > 22) { } else if (hour > 22) {
return "23:00"; 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);
} }
/** /**
@@ -357,12 +377,12 @@ public class LunarTime {
*/ */
public String getMaxHm() { public String getMaxHm() {
int hour = lunar.getHour(); int hour = lunar.getHour();
if (hour <1){ if (hour < 1) {
return "00:59"; return "00:59";
} else if (hour > 22) { } else if (hour > 22) {
return "23:59"; 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 @Override