/**
* 全局日期处理
*/
public class StringToDateConverter implements Converter<String, LocalDateTime> {
//private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
//private static final String shortDateFormat = "yyyy-MM-dd";
@Override
public LocalDateTime convert(String value) {
if(StringUtils.isEmpty(value)) {
return null;
}
try {
return LocalDateTime.parse(value.trim());
} catch (Exception e) {
throw new RuntimeException(String.format("parser %s to Date fail", value));
}
}
}