Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support timezone offsets in seconds for Range type (for historical dates in certain timezones) #759

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -54,7 +54,7 @@ public final class Range<T extends Comparable<? super T>> implements Serializabl
.appendPattern(".")
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 6, false)
.optionalEnd()
.appendOffset("+HH:mm", "Z")
.appendOffset("+HH:mm:ss", "Z")
.toFormatter();

private final T lower;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ public void localDateTimeTest() {
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,)"));
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,infinity)"));
}

@Test
public void zonedDateTimeTest() {
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[1900-01-01 00:00:00.123456+05:21:10,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
}


@Test
public void emptyInfinityEquality() {
assertEquals(integerRange("empty"), integerRange("empty"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class Range<T extends Comparable<? super T>> implements Serializabl
.appendPattern(".")
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 6, false)
.optionalEnd()
.appendOffset("+HH:mm", "Z")
.appendOffset("+HH:mm:ss", "Z")
.toFormatter();

private final T lower;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ public void localDateTimeTest() {
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,)"));
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,infinity)"));
}

@Test
public void zonedDateTimeTest() {
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[1900-01-01 00:00:00.123456+05:21:10,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
}


@Test
public void emptyInfinityEquality() {
assertEquals(integerRange("empty"), integerRange("empty"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class Range<T extends Comparable<? super T>> implements Serializabl
.appendPattern(".")
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 6, false)
.optionalEnd()
.appendOffset("+HH:mm", "Z")
.appendOffset("+HH:mm:ss", "Z")
.toFormatter();

private final T lower;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ public void localDateTimeTest() {
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,)"));
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,infinity)"));
}

@Test
public void zonedDateTimeTest() {
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[1900-01-01 00:00:00.123456+05:21:10,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
}


@Test
public void emptyInfinityEquality() {
assertEquals(integerRange("empty"), integerRange("empty"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class Range<T extends Comparable<? super T>> implements Serializabl
.appendPattern(".")
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 6, false)
.optionalEnd()
.appendOffset("+HH:mm", "Z")
.appendOffset("+HH:mm:ss", "Z")
.toFormatter();

private final T lower;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ public void localDateTimeTest() {
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,)"));
assertNotNull(Range.localDateTimeRange("[2019-03-27 16:33:10.123456,infinity)"));
}

@Test
public void zonedDateTimeTest() {
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.1234-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.12345-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456+05:30,)"));
assertNotNull(Range.zonedDateTimeRange("[1900-01-01 00:00:00.123456+05:21:10,)"));
assertNotNull(Range.zonedDateTimeRange("[2019-03-27 16:33:10.123456-06,infinity)"));
}


@Test
public void emptyInfinityEquality() {
assertEquals(integerRange("empty"), integerRange("empty"));
Expand Down