fix文档拆分: 日期校验4位
This commit is contained in:
@@ -1,21 +1,17 @@
|
|||||||
package com.jero.common.util;
|
package com.jero.common.util;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.*;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类描述:时间操作定义类
|
* 类描述:时间操作定义类
|
||||||
*
|
*
|
||||||
@@ -704,6 +700,9 @@ public class DateUtils extends PropertyEditorSupport {
|
|||||||
try {
|
try {
|
||||||
simpleDateFormat.setLenient(false);
|
simpleDateFormat.setLenient(false);
|
||||||
simpleDateFormat.parse(replace);
|
simpleDateFormat.parse(replace);
|
||||||
|
if (replace.contains("-") && replace.split("-")[0].length() > 4){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user