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

Applying modification pattern in #3288 to Jdk8DateCodec#write #3444

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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