mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix check bug
This commit is contained in:
@@ -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;
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user