Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3444 from T45K/related_to_3288
Browse files Browse the repository at this point in the history
Applying modification pattern in #3288 to Jdk8DateCodec#write
  • Loading branch information
wenshao authored Sep 14, 2020
2 parents 124fb5e + 4d0df8e commit 2d0d805
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public void write(JSONSerializer serializer, Object object, Object fieldName, Ty
if (format == null) {
if ((features & mask) != 0 || serializer.isEnabled(SerializerFeature.UseISO8601DateFormat)) {
format = formatter_iso8601_pattern;
} else if (serializer.isEnabled(SerializerFeature.WriteDateUseDateFormat)) {
format = JSON.DEFFAULT_DATE_FORMAT;
} else {
int nano = dateTime.getNano();
if (nano == 0) {
Expand All @@ -534,9 +536,6 @@ public void write(JSONSerializer serializer, Object object, Object fieldName, Ty

if (format != null) {
write(out, dateTime, format);
} else if (out.isEnabled(SerializerFeature.WriteDateUseDateFormat)) {
//使用固定格式转化时间
write(out, dateTime, JSON.DEFFAULT_DATE_FORMAT);
} else {
out.writeLong(dateTime.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli());
}
Expand Down

0 comments on commit 2d0d805

Please sign in to comment.