Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit f639be3

Browse files
committed
fix bug for getting month from simple date time
1 parent 6e9d96a commit f639be3

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111
<groupId>com.zhazhapan</groupId>
1212
<artifactId>util</artifactId>
13-
<version>1.1.1</version>
13+
<version>1.1.2</version>
1414
<packaging>jar</packaging>
1515

1616
<name>util</name>

src/main/java/com/zhazhapan/util/model/SimpleDateTime.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Integer getYear() {
6868
}
6969

7070
public Integer getMonth() {
71-
return month;
71+
return month + 1;
7272
}
7373

7474
public Integer getDay() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.zhazhapan.util.model;
2+
3+
import com.zhazhapan.util.DateUtils;
4+
import org.junit.Assert;
5+
import org.junit.Test;
6+
7+
import java.util.Date;
8+
9+
public class SimpleDateTimeTest {
10+
11+
@Test
12+
public void getMonth() {
13+
SimpleDateTime dateTime = new SimpleDateTime();
14+
Assert.assertEquals(DateUtils.getMonth(new Date()), dateTime.getMonth().toString());
15+
}
16+
}

0 commit comments

Comments
 (0)