Skip to content

Commit

Permalink
Merge branch 'main' into indexing-tracing-instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rayshrey committed Oct 19, 2023
2 parents c515aae + da24ca7 commit 8db4a65
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public DateTime(DateFormatter formatter, ZoneId timeZone, DateFieldMapper.Resolu
}

public DateTime(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_12_0)) {
this.formatter = DateFormatter.forPattern(in.readString(), in.readOptionalString());
} else {
this.formatter = DateFormatter.forPattern(in.readString());
Expand All @@ -265,12 +265,12 @@ public String getWriteableName() {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().before(Version.V_3_0_0) && formatter.equals(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER)) {
if (out.getVersion().before(Version.V_2_12_0) && formatter.equals(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER)) {
out.writeString(DateFieldMapper.LEGACY_DEFAULT_DATE_TIME_FORMATTER.pattern()); // required for backwards compatibility
} else {
out.writeString(formatter.pattern());
}
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_12_0)) {
out.writeOptionalString(formatter.printPattern());
}
out.writeString(timeZone.getId());
Expand Down

0 comments on commit 8db4a65

Please sign in to comment.