Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

MOB-5721 fix date pattern for QueryDate, hh --> HH #92

Merged
merged 4 commits into from
Jun 12, 2018
Merged
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 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allprojects {

group = 'com.constantcontact'
def isRelease = Boolean.valueOf(project.hasProperty("release") ? project.property("release") as String : "false")
version = '5.2.1' + (isRelease ? "" : "-SNAPSHOT")
version = '5.2.2' + (isRelease ? "" : "-SNAPSHOT")
}

apply plugin: "net.wooga.github"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The converter factory used for Jackson JSON conversion
*/
public class JacksonConverterFactory extends Converter.Factory {
public final static String ISO_8601_DATE_PATTERN = "yyyy-MM-dd'T'hh:mm:ss.SS'Z'";
public final static String ISO_8601_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SS'Z'";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you, this is correct now!


public final static SimpleDateFormat ISO_8601_DATE_FORMAT;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.constantcontact.v2;

import org.junit.Test;

import java.time.ZonedDateTime;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;

public class QueryDateTests {

@Test
public void test24HourDateConversions() {
ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs the "Z" at the end ("2018-06-04T09:07:30-04:00Z") to match the ISO-8601 format that AppConnect uses.

QueryDate qd = new QueryDate(date.toInstant().toEpochMilli());
assertThat(qd.toString().indexOf("2018-06-04T13:07:30.00Z"), not(equalTo(-1)));
}
}