Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a302e2a1a | ||
|
|
264481532b | ||
|
|
2fedf45007 | ||
|
|
0d226722d6 | ||
|
|
6dbf70186d | ||
|
|
b6bde78e59 | ||
|
|
701cec10a0 | ||
|
|
0a4d172ef6 |
33
CHANGELOG.md
33
CHANGELOG.md
@@ -3,3 +3,36 @@
|
||||
|
||||
## [1.3.12] - 2024-02-06
|
||||
1. 八字转阳历结果按时间先后排序,转换速度大幅提升。
|
||||
|
||||
## [1.3.13] - 2024-02-29
|
||||
1. 修复节气当天获取下一节气仍为当前节气的问题。
|
||||
2. 修复每日宜忌存在重复项的问题。
|
||||
3. 修复八字转阳历存在遗漏的问题。
|
||||
|
||||
## [1.3.14] - 2024-03-17
|
||||
1. 修复八字转阳历存在遗漏的问题。
|
||||
|
||||
## [1.3.15] - 2024-11-12
|
||||
1. 新增2025年法定假日数据。
|
||||
|
||||
## [1.4.0] - 2025-02-06
|
||||
1. 修复九星错别字。
|
||||
2. 优化每日宜忌算法。
|
||||
3. 去除每日宜忌的重复项。
|
||||
> 不建议使用该版本
|
||||
|
||||
## [1.7.0] - 2025-02-12
|
||||
1. 修复每日宜忌错别字。
|
||||
> 不建议使用该版本
|
||||
|
||||
## [1.7.1] - 2025-02-27
|
||||
1. 修复每日宜忌错误。
|
||||
> 不建议使用该版本
|
||||
|
||||
## [1.7.2] - 2025-03-05
|
||||
1. 修复每日宜忌错误。
|
||||
2. 更新2018之后的△T参数。
|
||||
|
||||
## [1.7.3] - 2025-04-07
|
||||
1. 修复个别日太岁方位的错误。
|
||||
2. 修复八字身宫计算错误的问题。
|
||||
|
||||
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.3.12</version>
|
||||
<version>1.7.3</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.3.12</version>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
3
pom.xml
3
pom.xml
@@ -7,7 +7,7 @@
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.3.12</version>
|
||||
<version>1.7.3</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>
|
||||
@@ -104,6 +104,7 @@
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<source>${source-version}</source>
|
||||
</configuration>
|
||||
|
||||
@@ -527,15 +527,12 @@ public class EightChar {
|
||||
public String getShenGong() {
|
||||
int monthZhiIndex = LunarUtil.find(getMonthZhi(), MONTH_ZHI, 0);
|
||||
int timeZhiIndex = LunarUtil.find(getTimeZhi(), LunarUtil.ZHI, 0);
|
||||
int offset = monthZhiIndex + timeZhiIndex;
|
||||
while (offset > 12) {
|
||||
offset -= 12;
|
||||
}
|
||||
int ganIndex = (lunar.getYearGanIndexExact() + 1) * 2 + (offset % 12);
|
||||
int offset = (monthZhiIndex + timeZhiIndex - 1) % 12;
|
||||
int ganIndex = (lunar.getYearGanIndexExact() + 1) * 2 + offset;
|
||||
while (ganIndex > 10) {
|
||||
ganIndex -= 10;
|
||||
}
|
||||
return LunarUtil.GAN[ganIndex] + MONTH_ZHI[offset];
|
||||
return LunarUtil.GAN[ganIndex + 1] + MONTH_ZHI[offset + 1];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1347,11 +1347,11 @@ public class Lunar {
|
||||
|
||||
protected String getDayPositionTaiSui(String dayInGanZhi, int yearZhiIndex) {
|
||||
String p;
|
||||
if ("甲子,乙丑,丙寅,丁卯,戊辰,已巳".contains(dayInGanZhi)) {
|
||||
if ("甲子,乙丑,丙寅,丁卯,戊辰,己巳".contains(dayInGanZhi)) {
|
||||
p = "震";
|
||||
} else if ("丙子,丁丑,戊寅,已卯,庚辰,辛巳".contains(dayInGanZhi)) {
|
||||
} else if ("丙子,丁丑,戊寅,己卯,庚辰,辛巳".contains(dayInGanZhi)) {
|
||||
p = "离";
|
||||
} else if ("戊子,已丑,庚寅,辛卯,壬辰,癸巳".contains(dayInGanZhi)) {
|
||||
} else if ("戊子,己丑,庚寅,辛卯,壬辰,癸巳".contains(dayInGanZhi)) {
|
||||
p = "中";
|
||||
} else if ("庚子,辛丑,壬寅,癸卯,甲辰,乙巳".contains(dayInGanZhi)) {
|
||||
p = "兑";
|
||||
@@ -2380,7 +2380,7 @@ public class Lunar {
|
||||
Solar solar = entry.getValue();
|
||||
String day = wholeDay ? solar.toYmd() : solar.toYmdHms();
|
||||
if (forward) {
|
||||
if (day.compareTo(today) < 0) {
|
||||
if (day.compareTo(today) <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (null == near) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class NineStar {
|
||||
/**
|
||||
* 七色
|
||||
*/
|
||||
public static final String[] COLOR = {"白", "黒", "碧", "绿", "黄", "白", "赤", "白", "紫"};
|
||||
public static final String[] COLOR = {"白", "黑", "碧", "绿", "黄", "白", "赤", "白", "紫"};
|
||||
|
||||
/**
|
||||
* 五行
|
||||
|
||||
@@ -89,9 +89,13 @@ public class Solar {
|
||||
if (month < 1 || month > 12) {
|
||||
throw new IllegalArgumentException(String.format("wrong month %d", month));
|
||||
}
|
||||
if (day < 1 || day > 31) {
|
||||
if (day < 1) {
|
||||
throw new IllegalArgumentException(String.format("wrong day %d", day));
|
||||
}
|
||||
int days = SolarUtil.getDaysOfMonth(year, month);
|
||||
if (day > days) {
|
||||
throw new IllegalArgumentException(String.format("only %d days in solar year %d month %d", days, year, month));
|
||||
}
|
||||
if (hour < 0 || hour > 23) {
|
||||
throw new IllegalArgumentException(String.format("wrong hour %d", hour));
|
||||
}
|
||||
@@ -302,7 +306,7 @@ public class Solar {
|
||||
m += 12;
|
||||
}
|
||||
// 月天干要一致
|
||||
if (((LunarUtil.find(yearGanZhi.substring(0, 1), LunarUtil.GAN, -1) + 1) * 2 + m) % 10 != LunarUtil.find(monthGanZhi.substring(0,1), LunarUtil.GAN, -1)) {
|
||||
if (((LunarUtil.find(yearGanZhi.substring(0, 1), LunarUtil.GAN, -1) + 1) * 2 + m) % 10 != LunarUtil.find(monthGanZhi.substring(0, 1), LunarUtil.GAN, -1)) {
|
||||
return l;
|
||||
}
|
||||
// 1年的立春是辛酉,序号57
|
||||
@@ -315,6 +319,10 @@ public class Solar {
|
||||
m *= 2;
|
||||
// 时辰地支转时刻,子时按零点算
|
||||
int h = LunarUtil.find(timeGanZhi.substring(1), LunarUtil.ZHI, -1) * 2;
|
||||
int[] hours = {h};
|
||||
if (0 == h && 2 == sect) {
|
||||
hours = new int[]{0, 23};
|
||||
}
|
||||
int startYear = baseYear - 1;
|
||||
|
||||
// 结束年
|
||||
@@ -330,29 +338,30 @@ public class Solar {
|
||||
// 节令推移,年干支和月干支就都匹配上了
|
||||
Solar solarTime = jieQiList.get(4 + m);
|
||||
if (solarTime.getYear() >= baseYear) {
|
||||
int mi = 0;
|
||||
int s = 0;
|
||||
// 日干支和节令干支的偏移值
|
||||
Lunar lunar = solarTime.getLunar();
|
||||
String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
|
||||
int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(dgz);
|
||||
int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(solarTime.getLunar().getDayInGanZhiExact2());
|
||||
if (d < 0) {
|
||||
d += 60;
|
||||
}
|
||||
if (d > 0) {
|
||||
// 从节令推移天数
|
||||
solarTime = solarTime.next(d);
|
||||
} else if (h == solarTime.getHour()) {
|
||||
// 如果正好是节令当天,且小时和节令的小时数相等的极端情况,把分钟和秒钟带上
|
||||
mi = solarTime.getMinute();
|
||||
s = solarTime.getSecond();
|
||||
}
|
||||
// 验证一下
|
||||
Solar solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), h, mi, s);
|
||||
lunar = solar.getLunar();
|
||||
dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
|
||||
if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) {
|
||||
l.add(solar);
|
||||
for (int hour : hours) {
|
||||
int mi = 0;
|
||||
int s = 0;
|
||||
if (d == 0 && hour == solarTime.getHour()) {
|
||||
// 如果正好是节令当天,且小时和节令的小时数相等的极端情况,把分钟和秒钟带上
|
||||
mi = solarTime.getMinute();
|
||||
s = solarTime.getSecond();
|
||||
}
|
||||
// 验证一下
|
||||
Solar solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), hour, mi, s);
|
||||
Lunar lunar = solar.getLunar();
|
||||
String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
|
||||
if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) {
|
||||
l.add(solar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,7 +385,7 @@ public class Solar {
|
||||
* @return 0123456
|
||||
*/
|
||||
public int getWeek() {
|
||||
return ((int)(getJulianDay() + 0.5) + 7000001) % 7;
|
||||
return ((int) (getJulianDay() + 0.5) + 7000001) % 7;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,6 +610,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 阳历日期相减,获得相差天数
|
||||
*
|
||||
* @param solar 阳历
|
||||
* @return 天数
|
||||
*/
|
||||
@@ -610,6 +620,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 阳历日期相减,获得相差分钟数
|
||||
*
|
||||
* @param solar 阳历
|
||||
* @return 分钟数
|
||||
*/
|
||||
@@ -628,6 +639,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 是否在指定日期之后
|
||||
*
|
||||
* @param solar 阳历
|
||||
* @return true/false
|
||||
*/
|
||||
@@ -667,6 +679,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 是否在指定日期之前
|
||||
*
|
||||
* @param solar 阳历
|
||||
* @return true/false
|
||||
*/
|
||||
@@ -706,6 +719,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 年推移
|
||||
*
|
||||
* @param years 年数
|
||||
* @return 阳历
|
||||
*/
|
||||
@@ -729,6 +743,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 月推移
|
||||
*
|
||||
* @param months 月数
|
||||
* @return 阳历
|
||||
*/
|
||||
@@ -789,7 +804,7 @@ public class Solar {
|
||||
d += days;
|
||||
}
|
||||
if (1582 == y && 10 == m) {
|
||||
if (d > 4 ) {
|
||||
if (d > 4) {
|
||||
d += 10;
|
||||
}
|
||||
}
|
||||
@@ -804,7 +819,7 @@ public class Solar {
|
||||
* @return 阳历日期
|
||||
*/
|
||||
public Solar next(int days, boolean onlyWorkday) {
|
||||
if(!onlyWorkday) {
|
||||
if (!onlyWorkday) {
|
||||
return next(days);
|
||||
}
|
||||
Solar solar = fromYmdHms(year, month, day, hour, minute, second);
|
||||
@@ -833,6 +848,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 小时推移
|
||||
*
|
||||
* @param hours 小时数
|
||||
* @return 阳历
|
||||
*/
|
||||
@@ -852,6 +868,7 @@ public class Solar {
|
||||
|
||||
/**
|
||||
* 获取薪资比例(感谢 https://gitee.com/smr1987)
|
||||
*
|
||||
* @return 薪资比例:1/2/3
|
||||
*/
|
||||
public int getSalaryRate() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.nlf.calendar.util.LunarUtil;
|
||||
*/
|
||||
public class LiuYue {
|
||||
/**
|
||||
* 序数,0-9
|
||||
* 序数,0-11
|
||||
*/
|
||||
private final int index;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -56,8 +56,10 @@ public class ShouXingUtil {
|
||||
2000, 63.87, 0.1, 0, 0,
|
||||
2005, 64.7, 0.21, 0, 0,
|
||||
2012, 66.8, 0.22, 0, 0,
|
||||
2018, 69.0, 0.36, 0, 0,
|
||||
2028, 72.6
|
||||
2018, 73.6, 0.40, 0, 0,
|
||||
2021, 78.1, 0.44, 0, 0,
|
||||
2024, 83.1, 0.55, 0, 0,
|
||||
2028, 98.6
|
||||
};
|
||||
private static final double[] XL0 = {
|
||||
10000000000D,
|
||||
|
||||
@@ -3,6 +3,7 @@ package test;
|
||||
import com.nlf.calendar.EightChar;
|
||||
import com.nlf.calendar.Lunar;
|
||||
import com.nlf.calendar.Solar;
|
||||
import com.nlf.calendar.eightchar.Yun;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -234,7 +235,7 @@ public class BaZiTest {
|
||||
@Test
|
||||
public void testShenGong1() {
|
||||
Lunar lunar = new Solar(1994, 12, 6, 2, 0, 0).getLunar();
|
||||
Assert.assertEquals("身宫", "乙丑", lunar.getEightChar().getShenGong());
|
||||
Assert.assertEquals("身宫", "丁丑", lunar.getEightChar().getShenGong());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -412,7 +413,7 @@ public class BaZiTest {
|
||||
Solar solar = new Solar(1986, 5, 29, 13, 37, 0);
|
||||
Lunar lunar = solar.getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("己丑", eightChar.getShenGong());
|
||||
Assert.assertEquals("辛丑", eightChar.getShenGong());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -493,4 +494,59 @@ public class BaZiTest {
|
||||
Assert.assertEquals("身宫", "乙巳", eightChar.getShenGong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test28() {
|
||||
Lunar lunar = Solar.fromYmdHms(1986, 5, 29, 13, 37, 0).getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Yun yun = eightChar.getYun(1, 2);
|
||||
Assert.assertEquals(2, yun.getStartYear());
|
||||
Assert.assertEquals(7, yun.getStartMonth());
|
||||
Assert.assertEquals(0, yun.getStartDay());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test29() {
|
||||
List<Solar> l = Solar.fromBaZi("甲辰","丙寅","壬戌","壬子", 2);
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("2024-02-28 23:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test30() {
|
||||
List<Solar> l = Solar.fromBaZi("甲辰","丙寅","癸亥","壬子", 1);
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("2024-02-29 00:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test31() {
|
||||
List<Solar> l = Solar.fromBaZi("丁卯","丁未","甲申","乙丑", 1, 1900);
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("1987-08-03 02:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test32() {
|
||||
Lunar lunar = Solar.fromYmdHms(1980, 6, 15, 12, 30, 30).getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("身宫", "己丑", eightChar.getShenGong());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,30 +21,30 @@ public class JieQiTest {
|
||||
Map<String,String> jieQi = new HashMap<String, String>(){
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put("冬至","2021-12-21 23:59:18");
|
||||
put("小寒","2022-01-05 17:14:03");
|
||||
put("大寒","2022-01-20 10:39:05");
|
||||
put("立春","2022-02-04 04:50:45");
|
||||
put("雨水","2022-02-19 00:43:00");
|
||||
put("惊蛰","2022-03-05 22:43:43");
|
||||
put("春分","2022-03-20 23:33:24");
|
||||
put("清明","2022-04-05 03:20:13");
|
||||
put("谷雨","2022-04-20 10:24:16");
|
||||
put("立夏","2022-05-05 20:25:56");
|
||||
put("小满","2022-05-21 09:22:35");
|
||||
put("芒种","2022-06-06 00:25:47");
|
||||
put("夏至","2022-06-21 17:13:50");
|
||||
put("小暑","2022-07-07 10:37:59");
|
||||
put("大暑","2022-07-23 04:06:58");
|
||||
put("立秋","2022-08-07 20:29:07");
|
||||
put("处暑","2022-08-23 11:16:09");
|
||||
put("白露","2022-09-07 23:32:17");
|
||||
put("秋分","2022-09-23 09:03:41");
|
||||
put("寒露","2022-10-08 15:22:26");
|
||||
put("霜降","2022-10-23 18:35:41");
|
||||
put("立冬","2022-11-07 18:45:28");
|
||||
put("小雪","2022-11-22 16:20:28");
|
||||
put("大雪","2022-12-07 11:46:15");
|
||||
put("冬至","2021-12-21 23:59:09");
|
||||
put("小寒","2022-01-05 17:13:54");
|
||||
put("大寒","2022-01-20 10:38:56");
|
||||
put("立春","2022-02-04 04:50:36");
|
||||
put("雨水","2022-02-19 00:42:50");
|
||||
put("惊蛰","2022-03-05 22:43:34");
|
||||
put("春分","2022-03-20 23:33:15");
|
||||
put("清明","2022-04-05 03:20:03");
|
||||
put("谷雨","2022-04-20 10:24:07");
|
||||
put("立夏","2022-05-05 20:25:47");
|
||||
put("小满","2022-05-21 09:22:25");
|
||||
put("芒种","2022-06-06 00:25:38");
|
||||
put("夏至","2022-06-21 17:13:40");
|
||||
put("小暑","2022-07-07 10:37:49");
|
||||
put("大暑","2022-07-23 04:06:49");
|
||||
put("立秋","2022-08-07 20:28:57");
|
||||
put("处暑","2022-08-23 11:15:59");
|
||||
put("白露","2022-09-07 23:32:07");
|
||||
put("秋分","2022-09-23 09:03:31");
|
||||
put("寒露","2022-10-08 15:22:16");
|
||||
put("霜降","2022-10-23 18:35:31");
|
||||
put("立冬","2022-11-07 18:45:18");
|
||||
put("小雪","2022-11-22 16:20:18");
|
||||
put("大雪","2022-12-07 11:46:04");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -183,7 +183,7 @@ public class JieQiTest {
|
||||
@Test
|
||||
public void test8() {
|
||||
Lunar lunar = Lunar.fromYmd(2050, 12, 1);
|
||||
Assert.assertEquals("2050-12-07 06:41:13", lunar.getJieQiTable().get("DA_XUE").toYmdHms());
|
||||
Assert.assertEquals("2050-12-07 06:40:53", lunar.getJieQiTable().get("DA_XUE").toYmdHms());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -197,7 +197,13 @@ public class JieQiTest {
|
||||
@Test
|
||||
public void test10() {
|
||||
Lunar lunar = Solar.fromYmd(2023, 6, 1).getLunar();
|
||||
Assert.assertEquals("2022-12-22 05:48:11", lunar.getJieQiTable().get("冬至").toYmdHms());
|
||||
Assert.assertEquals("2022-12-22 05:48:01", lunar.getJieQiTable().get("冬至").toYmdHms());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test11() {
|
||||
Lunar lunar = Solar.fromYmd(2025, 3, 5).getLunar();
|
||||
Assert.assertEquals("2025-03-05 16:07:02", lunar.getJieQiTable().get("惊蛰").toYmdHms());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import org.junit.Test;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 农历测试
|
||||
@@ -409,7 +408,7 @@ public class LunarTest {
|
||||
Lunar lunar = solar.getLunar();
|
||||
Assert.assertEquals("甲辰", lunar.getMonthInGanZhi());
|
||||
Assert.assertEquals("癸卯", lunar.getMonthInGanZhiExact());
|
||||
Assert.assertEquals(4, lunar.getDayJi().size());
|
||||
Assert.assertEquals("[出火, 入宅, 安葬, 伐木]", lunar.getDayJi().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -651,4 +650,32 @@ public class LunarTest {
|
||||
Assert.assertEquals("闭", lunar.getZhiXing());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test96() {
|
||||
Lunar lunar = Solar.fromYmd(2025, 2, 7).getLunar();
|
||||
Assert.assertEquals("[嫁娶, 祭祀, 祈福, 出行, 解除, 出火, 拆卸, 动土, 入宅, 移徙, 安床, 上梁, 栽种, 纳畜, 破土, 启钻, 安葬]", lunar.getDayYi().toString());
|
||||
Assert.assertEquals("[开市, 立券, 理发, 作灶]", lunar.getDayJi().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test97() {
|
||||
Lunar lunar = Solar.fromYmd(2025, 3, 5).getLunar();
|
||||
Assert.assertEquals("[破屋, 坏垣, 求医, 治病]", lunar.getDayYi().toString());
|
||||
Assert.assertEquals("[诸事不宜]", lunar.getDayJi().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test98() {
|
||||
Lunar lunar = Solar.fromYmd(2025, 5, 3).getLunar();
|
||||
Assert.assertEquals("[祭祀, 祈福, 求嗣, 斋醮, 沐浴, 纳畜, 入殓, 破土, 安葬]", lunar.getDayYi().toString());
|
||||
Assert.assertEquals("[移徙, 入宅, 嫁娶, 出行, 安床]", lunar.getDayJi().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test99() {
|
||||
Lunar lunar = Solar.fromYmd(2025, 5, 4).getLunar();
|
||||
Assert.assertEquals("[纳采, 祭祀, 祈福, 求嗣, 斋醮, 出行, 起基, 盖屋, 定磉, 安门, 入殓, 安葬]", lunar.getDayYi().toString());
|
||||
Assert.assertEquals("[嫁娶, 开市, 纳财, 出火]", lunar.getDayJi().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class NineStarTest {
|
||||
@Test
|
||||
public void test8() {
|
||||
LunarMonth m = LunarMonth.fromYm(2022, 1);
|
||||
Assert.assertEquals("二黒土天璇", m.getNineStar().toString());
|
||||
Assert.assertEquals("二黑土天璇", m.getNineStar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,4 +77,12 @@ public class NineStarTest {
|
||||
Assert.assertEquals("七赤金摇光", d.getTimeNineStar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test12() {
|
||||
LunarMonth m = LunarMonth.fromYm(2024, 11);
|
||||
Assert.assertEquals("四绿木天权", m.getNineStar().toString());
|
||||
m = LunarMonth.fromYm(2024, 12);
|
||||
Assert.assertEquals("三碧木天玑", m.getNineStar().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user