Skip to content

Commit 35e3996

Browse files
committed
Update date time filtering to include hour, minute, second
1 parent 3ab4ad1 commit 35e3996

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/com/twilio/http/Request.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
public class Request {
2323

24-
public static final String QUERY_STRING_DATE_FORMAT = "yyyy-MM-dd";
24+
public static final String QUERY_STRING_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
2525

2626
private final HttpMethod method;
2727
private final String url;

src/test/java/com/twilio/http/RequestTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,25 @@ public void testAddQueryDateRangeLowerBound() throws MalformedURLException {
8585
Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar");
8686
r.addQueryDateRange("baz", Range.greaterThan(new DateTime(2014, 1, 1, 0, 0)));
8787
URL url = r.constructURL();
88-
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01");
88+
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01T00:00:00");
8989
assertUrlsEqual(expected, url);
9090
}
9191

9292
@Test
9393
public void testAddQueryDateRangeUpperBound() throws MalformedURLException {
9494
Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar");
95-
r.addQueryDateRange("baz", Range.lessThan(new DateTime(2014, 1, 1, 0, 0)));
95+
r.addQueryDateRange("baz", Range.lessThan(new DateTime(2014, 1, 1, 22, 0)));
9696
URL url = r.constructURL();
97-
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01");
97+
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01T22:00:00");
9898
assertUrlsEqual(expected, url);
9999
}
100100

101101
@Test
102102
public void testAddQueryDateRangeClosed() throws MalformedURLException {
103103
Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar");
104-
r.addQueryDateRange("baz", Range.closed(new DateTime(2014, 1, 1, 0, 0), new DateTime(2014, 6, 1, 0, 0)));
104+
r.addQueryDateRange("baz", Range.closed(new DateTime(2014, 1, 10, 14, 0), new DateTime(2014, 6, 1, 16, 0)));
105105
URL url = r.constructURL();
106-
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01&baz<=2014-06-01");
106+
URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T14:00:00&baz<=2014-06-01T16:00:00");
107107
assertUrlsEqual(expected, url);
108108
}
109109

0 commit comments

Comments
 (0)