1
0
mirror of synced 2026-10-23 23:16:12 +08:00

Compare commits

..

2 Commits

Author SHA1 Message Date
6tail
0a5ea27b20 v1.2.18 修复SolarWeek获取当月第几周的错误。 2022-01-10 20:45:45 +08:00
6tail
3e256ddbd3 v1.2.17 修复九星错误;修复太岁方位错误。 2022-01-07 20:29:04 +08:00
10 changed files with 411 additions and 80 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.16</version> <version>1.2.18</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.16</version> <version>1.2.18</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.16</version> <version>1.2.18</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

@@ -833,16 +833,14 @@ public class Lunar {
* @return 节令 * @return 节令
*/ */
public String getJie() { public String getJie() {
String jie = ""; for(int i=0, j=JIE_QI_IN_USE.length; i<j; i+=2){
for(int i=0,j=JIE_QI_IN_USE.length;i<j;i+=2){
String key = JIE_QI_IN_USE[i]; String key = JIE_QI_IN_USE[i];
Solar d = jieQi.get(key); Solar d = jieQi.get(key);
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) { if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
jie = key; return convertJieQi(key);
break;
} }
} }
return convertJieQi(jie); return "";
} }
/** /**
@@ -851,16 +849,14 @@ public class Lunar {
* @return 气令 * @return 气令
*/ */
public String getQi() { public String getQi() {
String qi = ""; for(int i=1, j=JIE_QI_IN_USE.length; i<j; i+=2){
for(int i=1,j=JIE_QI_IN_USE.length;i<j;i+=2){
String key = JIE_QI_IN_USE[i]; String key = JIE_QI_IN_USE[i];
Solar d = jieQi.get(key); Solar d = jieQi.get(key);
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) { if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
qi = key; return convertJieQi(key);
break;
} }
} }
return convertJieQi(qi); return "";
} }
/** /**
@@ -1207,36 +1203,200 @@ public class Lunar {
} }
/** /**
* 获取日太岁方位 * 获取年太岁方位(默认流派2新年以立春零点起算)
* *
* @return 日太岁方位,如艮 * @return 太岁方位,如艮
*/ */
public String getDayPositionTaiSui() { public String getYearPositionTaiSui() {
return getYearPositionTaiSui(2);
}
/**
* 获取年太岁方位
*
* @param sect 流派:2为新年以立春零点起算;1为新年以正月初一起算;3为新年以立春节气交接的时刻起算
* @return 太岁方位,如艮
*/
public String getYearPositionTaiSui(int sect) {
int yearZhiIndex;
switch (sect) {
case 1:
yearZhiIndex = this.yearZhiIndex;
break;
case 3:
yearZhiIndex = this.yearZhiIndexExact;
break;
default:
yearZhiIndex = this.yearZhiIndexByLiChun;
}
return LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
}
/**
* 获取年太岁方位描述(默认流派2新年以立春零点起算)
*
* @return 太岁方位描述,如东北
*/
public String getYearPositionTaiSuiDesc() {
return getYearPositionTaiSuiDesc(2);
}
/**
* 获取年太岁方位描述
*
* @param sect 流派:2为新年以立春零点起算;1为新年以正月初一起算;3为新年以立春节气交接的时刻起算
* @return 太岁方位描述,如东北
*/
public String getYearPositionTaiSuiDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getYearPositionTaiSui(sect));
}
protected String getMonthPositionTaiSui(int monthZhiIndex, int monthGanIndex){
String p; String p;
String gz = getDayInGanZhi(); int m = monthZhiIndex - LunarUtil.BASE_MONTH_ZHI_INDEX;
if ("甲子,乙丑,丙寅,丁卯,戊辰,已巳".contains(gz)) { if (m < 0) {
p = "震"; m += 12;
} else if ("丙子,丁丑,戊寅,已卯,庚辰,辛巳".contains(gz)) { }
p = "离"; switch(m) {
} else if ("戊子,已丑,庚寅,辛卯,壬辰,癸巳".contains(gz)) { case 0:
p = "中"; case 4:
} else if ("庚子,辛丑,壬寅,癸卯,甲辰,乙巳".contains(gz)) { case 8:
p = "兑"; p = "艮";
} else if ("壬子,癸丑,甲寅,乙卯,丙辰,丁巳".contains(gz)) { break;
p = "坎"; case 2:
} else{ case 6:
p = LunarYear.fromYear(this.getYear()).getPositionTaiSui(); case 10:
p = "坤";
break;
case 3:
case 7:
case 11:
p = "巽";
break;
default:
p = LunarUtil.POSITION_GAN[monthGanIndex];
} }
return p; return p;
} }
/** /**
* 获取日太岁方位描述 * 获取月太岁方位(默认流派2新的一月以节交接当天零点起算)
* *
* @return 日太岁方位描述,如东北 * @return 太岁方位,如艮
*/
public String getMonthPositionTaiSui() {
return getMonthPositionTaiSui(2);
}
/**
* 获取月太岁方位
*
* @param sect 流派:2为新的一月以节交接当天零点起算;3为新的一月以节交接准确时刻起算
* @return 太岁方位,如艮
*/
public String getMonthPositionTaiSui(int sect) {
int monthZhiIndex;
int monthGanIndex;
switch (sect) {
case 3:
monthZhiIndex = this.monthZhiIndexExact;
monthGanIndex = this.monthGanIndexExact;
break;
default:
monthZhiIndex = this.monthZhiIndex;
monthGanIndex = this.monthGanIndex;
}
return getMonthPositionTaiSui(monthZhiIndex, monthGanIndex);
}
/**
* 获取月太岁方位描述(默认流派2新的一月以节交接当天零点起算)
*
* @return 太岁方位描述,如东北
*/
public String getMonthPositionTaiSuiDesc() {
return getMonthPositionTaiSuiDesc(2);
}
/**
* 获取月太岁方位描述
*
* @param sect 流派:2为新的一月以节交接当天零点起算;3为新的一月以节交接准确时刻起算
* @return 太岁方位描述,如东北
*/
public String getMonthPositionTaiSuiDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getMonthPositionTaiSui(sect));
}
protected String getDayPositionTaiSui(String dayInGanZhi, int yearZhiIndex){
String p;
if ("甲子,乙丑,丙寅,丁卯,戊辰,已巳".contains(dayInGanZhi)) {
p = "震";
} else if ("丙子,丁丑,戊寅,已卯,庚辰,辛巳".contains(dayInGanZhi)) {
p = "离";
} else if ("戊子,已丑,庚寅,辛卯,壬辰,癸巳".contains(dayInGanZhi)) {
p = "中";
} else if ("庚子,辛丑,壬寅,癸卯,甲辰,乙巳".contains(dayInGanZhi)) {
p = "兑";
} else if ("壬子,癸丑,甲寅,乙卯,丙辰,丁巳".contains(dayInGanZhi)) {
p = "坎";
} else{
p = LunarUtil.POSITION_TAI_SUI_YEAR[yearZhiIndex];
}
return p;
}
/**
* 获取日太岁方位(默认流派2新年以立春零点起算)
*
* @return 太岁方位,如艮
*/
public String getDayPositionTaiSui() {
return getDayPositionTaiSui(2);
}
/**
* 获取日太岁方位
*
* @param sect 流派:2新年以立春零点起算;1新年以正月初一起算;3新年以立春节气交接的时刻起算
* @return 太岁方位,如艮
*/
public String getDayPositionTaiSui(int sect) {
String dayInGanZhi;
int yearZhiIndex;
switch (sect) {
case 1:
dayInGanZhi = getDayInGanZhi();
yearZhiIndex = this.yearZhiIndex;
break;
case 3:
dayInGanZhi = getDayInGanZhi();
yearZhiIndex = this.yearZhiIndexExact;
break;
default:
dayInGanZhi = getDayInGanZhiExact2();
yearZhiIndex = this.yearZhiIndexByLiChun;
}
return getDayPositionTaiSui(dayInGanZhi, yearZhiIndex);
}
/**
* 获取日太岁方位描述(默认流派2新年以立春零点起算)
*
* @return 太岁方位描述,如东北
*/ */
public String getDayPositionTaiSuiDesc() { public String getDayPositionTaiSuiDesc() {
return LunarUtil.POSITION_DESC.get(getDayPositionTaiSui()); return getDayPositionTaiSuiDesc(2);
}
/**
* 获取日太岁方位描述
*
* @param sect 流派:2新年以立春零点起算;1新年以正月初一起算;3新年以立春节气交接的时刻起算
* @return 太岁方位描述,如东北
*/
public String getDayPositionTaiSuiDesc(int sect) {
return LunarUtil.POSITION_DESC.get(getDayPositionTaiSui(sect));
} }
/** /**
@@ -1855,37 +2015,92 @@ public class Lunar {
return LunarUtil.YUE_XIANG[day]; return LunarUtil.YUE_XIANG[day];
} }
protected NineStar getYearNineStar(String yearInGanZhi) {
int index = LunarUtil.getJiaZiIndex(yearInGanZhi) + 1;
int yearOffset = 0;
if (index != LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1) {
yearOffset = -1;
}
int yuan = ((this.year + yearOffset + 2696) / 60) % 3;
int offset = (62 + yuan * 3 - index) % 9;
if(0 == offset){
offset = 9;
}
return NineStar.fromIndex(offset - 1);
}
/** /**
* 获取值年九星(流年紫白星起例歌诀:年上吉星论甲子,逐年星逆中宫起;上中下作三元汇,一上四中七下兑。) * 获取值年九星(默认流派2新年以立春零点起算。流年紫白星起例歌诀:年上吉星论甲子,逐年星逆中宫起;上中下作三元汇,一上四中七下兑。)
* *
* @return 值年九星 * @return 值年九星
*/ */
public NineStar getYearNineStar() { public NineStar getYearNineStar() {
return LunarYear.fromYear(year).getNineStar(); return getYearNineStar(2);
}
/**
* 获取值年九星(流年紫白星起例歌诀:年上吉星论甲子,逐年星逆中宫起;上中下作三元汇,一上四中七下兑。)
*
* @param sect 流派:2为新年以立春零点起算;1为新年以正月初一起算;3为新年以立春节气交接的时刻起算
* @return 值年九星
*/
public NineStar getYearNineStar(int sect) {
String yearInGanZhi;
switch (sect) {
case 1:
yearInGanZhi = this.getYearInGanZhi();
break;
case 3:
yearInGanZhi = this.getYearInGanZhiExact();
break;
default:
yearInGanZhi = this.getYearInGanZhiByLiChun();
}
return getYearNineStar(yearInGanZhi);
}
protected NineStar getMonthNineStar(int yearZhiIndex, int monthZhiIndex) {
int index = yearZhiIndex % 3;
int n = 27 - (index * 3);
if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
n -= 3;
}
int offset = (n - monthZhiIndex) % 9;
return NineStar.fromIndex(offset);
}
/**
* 获取值月九星(流派2新的一月以节交接当天零点起算。月紫白星歌诀:子午卯酉八白起,寅申巳亥二黑求,辰戌丑未五黄中。)
*
* @return 值月九星
*/
public NineStar getMonthNineStar() {
return getMonthNineStar(2);
} }
/** /**
* 获取值月九星(月紫白星歌诀:子午卯酉八白起,寅申巳亥二黑求,辰戌丑未五黄中。) * 获取值月九星(月紫白星歌诀:子午卯酉八白起,寅申巳亥二黑求,辰戌丑未五黄中。)
* *
* @param sect 流派:2为新的一月以节交接当天零点起算;3为新的一月以节交接准确时刻起算
* @return 值月九星 * @return 值月九星
*/ */
public NineStar getMonthNineStar() { public NineStar getMonthNineStar(int sect) {
int n = 12; int yearZhiIndex;
String yearZhi = getYearZhi(); int monthZhiIndex;
if ("子午卯酉".contains(yearZhi)) { switch (sect) {
n = 18; case 1:
} else if ("辰戌丑未".contains(yearZhi)) { yearZhiIndex = this.yearZhiIndex;
n = 15; monthZhiIndex = this.monthZhiIndex;
break;
case 3:
yearZhiIndex = this.yearZhiIndexExact;
monthZhiIndex = this.monthZhiIndexExact;
break;
default:
yearZhiIndex = this.yearZhiIndexByLiChun;
monthZhiIndex = this.monthZhiIndex;
} }
int m = month; return getMonthNineStar(yearZhiIndex, monthZhiIndex);
if(m < 0){
m = -m;
}
int offset = (n - m) % 9;
if(0 == offset){
offset = 9;
}
return NineStar.fromIndex(offset - 1);
} }
/** /**
@@ -2170,15 +2385,13 @@ public class Lunar {
* @return 节气名称 * @return 节气名称
*/ */
public String getJieQi() { public String getJieQi() {
String name = "";
for (Map.Entry<String, Solar> jq : jieQi.entrySet()) { for (Map.Entry<String, Solar> jq : jieQi.entrySet()) {
Solar d = jq.getValue(); Solar d = jq.getValue();
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) { if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
name = jq.getKey(); return convertJieQi(jq.getKey());
break;
} }
} }
return convertJieQi(name); return "";
} }
/** /**
@@ -2187,8 +2400,13 @@ public class Lunar {
* @return 节气对象 * @return 节气对象
*/ */
public JieQi getCurrentJieQi() { public JieQi getCurrentJieQi() {
String name = getJieQi(); for (Map.Entry<String, Solar> jq : jieQi.entrySet()) {
return name.length() > 0 ? new JieQi(name, solar) : null; Solar d = jq.getValue();
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
return new JieQi(convertJieQi(jq.getKey()), d);
}
}
return null;
} }
/** /**
@@ -2197,8 +2415,14 @@ public class Lunar {
* @return 节气对象 * @return 节气对象
*/ */
public JieQi getCurrentJie() { public JieQi getCurrentJie() {
String name = getJie(); for(int i=0, j=JIE_QI_IN_USE.length; i<j; i+=2){
return name.length() > 0 ? new JieQi(name, solar) : null; String key = JIE_QI_IN_USE[i];
Solar d = jieQi.get(key);
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
return new JieQi(convertJieQi(key), d);
}
}
return null;
} }
/** /**
@@ -2207,8 +2431,14 @@ public class Lunar {
* @return 节气对象 * @return 节气对象
*/ */
public JieQi getCurrentQi() { public JieQi getCurrentQi() {
String name = getQi(); for(int i=1, j=JIE_QI_IN_USE.length; i<j; i+=2){
return name.length() > 0 ? new JieQi(name, solar) : null; String key = JIE_QI_IN_USE[i];
Solar d = jieQi.get(key);
if (d.getYear() == solar.getYear() && d.getMonth() == solar.getMonth() && d.getDay() == solar.getDay()) {
return new JieQi(convertJieQi(key), d);
}
}
return null;
} }
public String toFullString() { public String toFullString() {
@@ -2745,10 +2975,8 @@ public class Lunar {
public String getHou() { public String getHou() {
JieQi jieQi = getPrevJieQi(true); JieQi jieQi = getPrevJieQi(true);
String name = jieQi.getName(); String name = jieQi.getName();
Calendar currentCalendar = ExactDate.fromYmd(solar.getYear(), solar.getMonth(), solar.getDay());
Solar startSolar = jieQi.getSolar(); Solar startSolar = jieQi.getSolar();
Calendar startCalendar = ExactDate.fromYmd(startSolar.getYear(), startSolar.getMonth(), startSolar.getDay()); int days = ExactDate.getDaysBetween(startSolar.getYear(), startSolar.getMonth(), startSolar.getDay(), solar.getYear(), solar.getMonth(), solar.getDay());
int days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
return String.format("%s %s", name, LunarUtil.HOU[(days / 5) % LunarUtil.HOU.length]); return String.format("%s %s", name, LunarUtil.HOU[(days / 5) % LunarUtil.HOU.length]);
} }

View File

@@ -132,6 +132,22 @@ public class LunarMonth {
return LunarUtil.POSITION_DESC.get(getPositionTaiSui()); return LunarUtil.POSITION_DESC.get(getPositionTaiSui());
} }
/**
* 获取月九星
*
* @return 九星
*/
public NineStar getNineStar() {
int index = LunarYear.fromYear(year).getZhiIndex() % 3;
int m = Math.abs(month);
int monthZhiIndex = (13 + m) % 12;
int n = 27 - (index * 3);
if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
n -= 3;
}
int offset = (n - monthZhiIndex) % 9;
return NineStar.fromIndex(offset);
}
@Override @Override
public String toString() { public String toString() {

View File

@@ -214,6 +214,24 @@ public class LunarYear {
return jieQiJulianDays; return jieQiJulianDays;
} }
/**
* 获取天干序号,从0开始
*
* @return 序号
*/
public int getGanIndex() {
return ganIndex;
}
/**
* 获取地支序号,从0开始
*
* @return 序号
*/
public int getZhiIndex() {
return zhiIndex;
}
/** /**
* 获取天干 * 获取天干
* *
@@ -436,15 +454,10 @@ public class LunarYear {
* @return 九星 * @return 九星
*/ */
public NineStar getNineStar() { public NineStar getNineStar() {
int index = LunarUtil.getJiaZiIndex(this.getGanZhi()) + 1; int index = LunarUtil.getJiaZiIndex(getGanZhi()) + 1;
int n = 65; int yuan = ((this.year + 2696) / 60) % 3;
if ("中元".equals(getYuan())) { int offset = (62 + yuan * 3 - index) % 9;
n = 68; if(0 == offset){
} else if ("下元".equals(getYuan())) {
n = 62;
}
int offset = (n - index) % 9;
if (0 == offset) {
offset = 9; offset = 9;
} }
return NineStar.fromIndex(offset - 1); return NineStar.fromIndex(offset - 1);
@@ -586,4 +599,5 @@ public class LunarYear {
public String toFullString() { public String toFullString() {
return year + "年"; return year + "年";
} }
} }

View File

@@ -159,10 +159,11 @@ public class SolarWeek {
public int getIndex() { public int getIndex() {
Calendar c = ExactDate.fromYmd(year, month, 1); Calendar c = ExactDate.fromYmd(year, month, 1);
int firstDayWeek = c.get(Calendar.DAY_OF_WEEK) - 1; int firstDayWeek = c.get(Calendar.DAY_OF_WEEK) - 1;
if (firstDayWeek == 0) { int offset = firstDayWeek - start;
firstDayWeek = 7; if(offset < 0) {
offset += 7;
} }
return (int) Math.ceil((day + firstDayWeek - start) / 7D); return (int) Math.ceil((day + offset) / 7D);
} }
/** /**

View File

@@ -62,10 +62,8 @@ public class Yun {
int startTimeZhiIndex = (start.getHour() == 23) ? 11 : LunarUtil.getTimeZhiIndex(start.toYmdHms().substring(11, 16)); int startTimeZhiIndex = (start.getHour() == 23) ? 11 : LunarUtil.getTimeZhiIndex(start.toYmdHms().substring(11, 16));
// 时辰差 // 时辰差
int hourDiff = endTimeZhiIndex - startTimeZhiIndex; int hourDiff = endTimeZhiIndex - startTimeZhiIndex;
Calendar endCalendar = ExactDate.fromYmd(end.getYear(), end.getMonth(), end.getDay());
Calendar startCalendar = ExactDate.fromYmd(start.getYear(), start.getMonth(), start.getDay());
// 天数差 // 天数差
int dayDiff = (int) ((endCalendar.getTimeInMillis() - startCalendar.getTimeInMillis()) / (1000 * 3600 * 24)); int dayDiff = ExactDate.getDaysBetween(start.getYear(), start.getMonth(), start.getDay(), end.getYear(), end.getMonth(), end.getDay());
if (hourDiff < 0) { if (hourDiff < 0) {
hourDiff += 12; hourDiff += 12;
dayDiff--; dayDiff--;

View File

@@ -159,13 +159,13 @@ public class LunarTest {
@Test @Test
public void test23() { public void test23() {
Lunar lunar = Lunar.fromYmd(2022, 1, 1); Lunar lunar = Lunar.fromYmd(2022, 1, 1);
Assert.assertEquals("五黄土玉衡", lunar.getYearNineStar().toString()); Assert.assertEquals("六白金开阳", lunar.getYearNineStar().toString());
} }
@Test @Test
public void test24() { public void test24() {
Lunar lunar = Lunar.fromYmd(2033, 1, 1); Lunar lunar = Lunar.fromYmd(2033, 1, 1);
Assert.assertEquals("三碧木天玑", lunar.getYearNineStar().toString()); Assert.assertEquals("四绿木天权", lunar.getYearNineStar().toString());
} }
@Test @Test

View File

@@ -0,0 +1,74 @@
package test;
import com.nlf.calendar.SolarWeek;
import org.junit.Assert;
import org.junit.Test;
/**
* 阳历周测试
*
* @author 6tail
*/
public class SolarWeekTest {
@Test
public void test() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 1, 0);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test1() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 7, 0);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test2() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 8, 0);
Assert.assertEquals(2, week.getIndex());
}
@Test
public void test3() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 1, 1);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test4() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 2, 1);
Assert.assertEquals(2, week.getIndex());
}
@Test
public void test5() {
SolarWeek week = SolarWeek.fromYmd(2022, 5, 8, 1);
Assert.assertEquals(2, week.getIndex());
}
@Test
public void test6() {
SolarWeek week = SolarWeek.fromYmd(2021, 11, 1, 0);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test7() {
SolarWeek week = SolarWeek.fromYmd(2021, 11, 1, 1);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test8() {
SolarWeek week = SolarWeek.fromYmd(2021, 5, 2, 2);
Assert.assertEquals(1, week.getIndex());
}
@Test
public void test9() {
SolarWeek week = SolarWeek.fromYmd(2021, 5, 4, 2);
Assert.assertEquals(2, week.getIndex());
}
}