Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a17402241a |
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.6tail</groupId>
|
<groupId>cn.6tail</groupId>
|
||||||
<artifactId>lunar</artifactId>
|
<artifactId>lunar</artifactId>
|
||||||
<version>1.3.8</version>
|
<version>1.3.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -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.3.8</version>
|
<version>1.3.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -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.3.8</version>
|
<version>1.3.9</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>
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ public class Solar {
|
|||||||
* @return 0123456
|
* @return 0123456
|
||||||
*/
|
*/
|
||||||
public int getWeek() {
|
public int getWeek() {
|
||||||
return ((int)getJulianDay() + 7000002) % 7;
|
return ((int)(getJulianDay() + 0.5) + 7000001) % 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class BaZiTestNew {
|
|||||||
public void test7() {
|
public void test7() {
|
||||||
Solar solar = new Solar(2020, 5, 26, 23, 43, 0);
|
Solar solar = new Solar(2020, 5, 26, 23, 43, 0);
|
||||||
Lunar lunar = solar.getLunar();
|
Lunar lunar = solar.getLunar();
|
||||||
//庚子, 辛巳, 庚午, 丙子]
|
// [庚子, 辛巳, 庚午, 丙子]
|
||||||
System.out.println(lunar.getEightChar());
|
System.out.println(lunar.getEightChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,4 +97,16 @@ public class WeekTest {
|
|||||||
Assert.assertEquals(3, solar.getWeek());
|
Assert.assertEquals(3, solar.getWeek());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test10(){
|
||||||
|
Assert.assertEquals(6, Solar.fromYmd(1961, 9, 30).getWeek());
|
||||||
|
Assert.assertEquals(6, Solar.fromYmdHms(1961, 9, 30, 23, 59, 59).getWeek());
|
||||||
|
Assert.assertEquals(6, Solar.fromYmdHms(1961, 9, 30, 20, 0, 0).getWeek());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test11(){
|
||||||
|
Assert.assertEquals(3, Solar.fromYmdHms(2021, 9, 15, 20, 0, 0).getWeek());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user