优化时间转换
This commit is contained in:
parent
e322c28fa9
commit
15dd5dc9ca
|
|
@ -20,6 +20,10 @@ public class SmartDateDeserializer extends JsonDeserializer<Date> {
|
|||
}
|
||||
return TimeUtils.parseDate(str);
|
||||
}
|
||||
if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) {
|
||||
long ts = p.getLongValue();
|
||||
return new Date(ts);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.jetlinks.community.utils;
|
|||
|
||||
import lombok.SneakyThrows;
|
||||
import org.hswebframework.utils.time.DateFormatter;
|
||||
import org.jetlinks.core.metadata.types.DateTimeType;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.*;
|
||||
|
|
@ -166,6 +167,6 @@ public class DateMathParser {
|
|||
if (StringUtils.isEmpty(value)) {
|
||||
throw new IllegalArgumentException("cannot parse empty date");
|
||||
}
|
||||
return DateFormatter.fromString(value).getTime();
|
||||
return DateTimeType.GLOBAL.convert(value).getTime();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue