Add getZone to JodaCompatibleZonedDateTime (#37084)
The ZonedDateTime#getZone() was not accessible via the Joda shim. This commit adds getZone() and exposes it through painless.
This commit is contained in:
parent
586093ec5e
commit
d625b79df2
|
@ -87,6 +87,7 @@ class org.elasticsearch.script.JodaCompatibleZonedDateTime {
|
|||
int getNano()
|
||||
int getSecond()
|
||||
int getYear()
|
||||
ZoneId getZone()
|
||||
ZonedDateTime minus(TemporalAmount)
|
||||
ZonedDateTime minus(long,TemporalUnit)
|
||||
ZonedDateTime minusYears(long)
|
||||
|
|
|
@ -151,6 +151,10 @@ public class JodaCompatibleZonedDateTime {
|
|||
return dt.getYear();
|
||||
}
|
||||
|
||||
public ZoneId getZone() {
|
||||
return dt.getZone();
|
||||
}
|
||||
|
||||
public ZonedDateTime minus(TemporalAmount delta) {
|
||||
return dt.minus(delta);
|
||||
}
|
||||
|
|
|
@ -152,6 +152,10 @@ public class JodaCompatibleZonedDateTimeTests extends ESTestCase {
|
|||
assertThat(javaTime.getYear(), equalTo(jodaTime.getYear()));
|
||||
}
|
||||
|
||||
public void testZone() {
|
||||
assertThat(javaTime.getZone().getId(), equalTo(jodaTime.getZone().getID()));
|
||||
}
|
||||
|
||||
public void testMillis() {
|
||||
assertMethodDeprecation(() -> assertThat(javaTime.getMillis(), equalTo(jodaTime.getMillis())),
|
||||
"getMillis()", "toInstant().toEpochMilli()");
|
||||
|
|
Loading…
Reference in New Issue