fix check bug

This commit is contained in:
Looly
2020-10-21 12:58:03 +08:00
parent c008d0a081
commit a114113be0
7 changed files with 75 additions and 10 deletions

View File

@@ -48,7 +48,7 @@ public class ChineseDate {
*/
public ChineseDate(Date date) {
// 求出和1900年1月31日相差的天数
int offset = (int) ((date.getTime() / DateUnit.DAY.getMillis()) - BASE_DAY);
int offset = (int) ((DateUtil.beginOfDay(date).getTime() / DateUnit.DAY.getMillis()) - BASE_DAY);
// 计算农历年份
// 用offset减去每农历年的天数计算当天是农历第几天offset是当年的第几天
int daysOfYear;

View File

@@ -862,7 +862,7 @@ public class FileUtil extends PathUtil {
*/
public static File copyFile(String src, String dest, StandardCopyOption... options) throws IORuntimeException {
Assert.notBlank(src, "Source File path is blank !");
Assert.notNull(src, "Destination File path is null !");
Assert.notBlank(dest, "Destination File path is blank !");
return copyFile(Paths.get(src), Paths.get(dest), options).toFile();
}

View File

@@ -95,4 +95,10 @@ public class ChineseDateTest {
date = new ChineseDate(DateUtil.parseDate("1991-09-15"));
Assert.assertEquals("辛未羊年 八月初八", date.toString());
}
@Test
public void dateTest2(){
ChineseDate date = new ChineseDate(DateUtil.parse("2020-10-19 11:12:23"));
Assert.assertEquals("庚子鼠年 九月初三", date.toString());
}
}