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

chore: correcting dateTime format as per RFC3339 format #798

Open
wants to merge 1 commit into
base: main
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
2 changes: 1 addition & 1 deletion src/main/java/com/twilio/http/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Request {

private static final String DEFAULT_REGION = "us1";

public static final String QUERY_STRING_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
public static final String QUERY_STRING_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX";
public static final String QUERY_STRING_DATE_FORMAT = "yyyy-MM-dd";

private final HttpMethod method;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/twilio/http/RequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void testAddQueryDateTimeRangeLowerBound() throws MalformedURLException {
Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar");
r.addQueryDateTimeRange("baz", ZonedDateTime.of(2014, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC), null);
URL url = r.constructURL();
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01T00:00:00");
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01T00:00:00Z");
assertUrlsEqual(expected, url);
}

Expand All @@ -185,7 +185,7 @@ public void testAddQueryDateTimeRangeUpperBound() throws MalformedURLException {
Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar");
r.addQueryDateTimeRange("baz", null, ZonedDateTime.of(2014, 1, 1, 22, 0, 0, 0, ZoneOffset.UTC));
URL url = r.constructURL();
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01T22:00:00");
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01T22:00:00Z");
assertUrlsEqual(expected, url);
}

Expand All @@ -195,7 +195,7 @@ public void testAddQueryDateTimeRangeClosed() throws MalformedURLException {
r.addQueryDateTimeRange("baz", ZonedDateTime.of(2014, 1, 10, 14, 0, 0, 0, ZoneOffset.UTC),
ZonedDateTime.of(2014, 6, 1, 16, 0, 0, 0, ZoneOffset.UTC));
URL url = r.constructURL();
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T14:00:00&baz<=2014-06-01T16:00:00");
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T14:00:00Z&baz<=2014-06-01T16:00:00Z");
assertUrlsEqual(expected, url);
}

Expand All @@ -207,7 +207,7 @@ public void testAddQueryDateTimeRangeClosedNotUTC() throws MalformedURLException
ZonedDateTime end = ZonedDateTime.of(2014, 6, 1, 16, 0, 0, 0, z);
r.addQueryDateTimeRange("baz", begin, end);
URL url = r.constructURL();
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T20:00:00&baz<=2014-06-01T21:00:00");
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T20:00:00Z&baz<=2014-06-01T21:00:00Z");
assertUrlsEqual(expected, url);
}

Expand Down
Loading