File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
main/java/org/gitlab4j/api/utils
test/java/org/gitlab4j/api Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class ISO8601 {
2828 public static final String UTC_PATTERN = "yyyy-MM-dd HH:mm:ss 'UTC'" ;
2929
3030 private static final DateTimeFormatter ODT_WITH_MSEC_PARSER = new DateTimeFormatterBuilder ().appendPattern ("yyyy-MM-dd[['T'][ ]HH:mm:ss.SSS[ ][XXXXX][XXXX]]" ).toFormatter ();
31- private static final DateTimeFormatter ODT_PARSER = new DateTimeFormatterBuilder ().appendPattern ("yyyy-MM-dd[['T'][ ]HH:mm:ss[.SSS][ ][X][XXX ]]" )
31+ private static final DateTimeFormatter ODT_PARSER = new DateTimeFormatterBuilder ().appendPattern ("yyyy-MM-dd[['T'][ ]HH:mm:ss[.SSS][ ][XXX][X ]]" )
3232 .parseDefaulting (ChronoField .HOUR_OF_DAY , 0 )
3333 .parseDefaulting (ChronoField .MINUTE_OF_HOUR , 0 )
3434 .parseDefaulting (ChronoField .SECOND_OF_MINUTE , 0 )
Original file line number Diff line number Diff line change @@ -20,8 +20,10 @@ public class TestISO8601 {
2020 private static final String SPACEY_GITLAB_DATE_WITH_MSEC = "2018-03-12 10:16:46.123 +0700" ;
2121 private static final String ISO8601_GITLAB_DATE_WITH_MSEC ="2018-03-12T10:16:46.123+0700" ;
2222
23+ private static final String ISO8601_DATE_OFFSET_COLON = "2018-03-12T10:16:46+07:00" ;
24+
2325 private static final String ISO8601_DATE_MSEC = "2018-03-12T10:16:46.123Z" ;
24- private static final String ISO8601_DATE_OFFSET_COLON = "2018-03-12T10:16:46.123+00:00" ;
26+ private static final String ISO8601_DATE_MSEC_OFFSET_COLON = "2018-03-12T10:16:46.123+00:00" ;
2527 private static final String ISO8601_GITLAB_DATE_MSEC = "2018-03-12T03:16:46.123-0700" ;
2628 private static final String SPACEY_GITLAB_UTC_DATE_MSEC = "2018-03-12 10:16:46.123 UTC" ;
2729
@@ -69,8 +71,15 @@ public void testMsecDateParse() throws ParseException {
6971
7072 @ Test
7173 public void testOffsetColonDateParse () throws ParseException {
74+ Date gitlabOffsetDate = ISO8601 .toDate (ISO8601_DATE_OFFSET_COLON );
75+ Date gitlabDate = ISO8601 .toDate (ISO8601_GITLAB_DATE );
76+ assertEquals (gitlabDate , gitlabOffsetDate );
77+ }
78+
79+ @ Test
80+ public void testOffsetColonMsecDateParse () throws ParseException {
7281 Date msecDate = ISO8601 .toDate (ISO8601_DATE_MSEC );
73- Date gitlabMsecDate = ISO8601 .toDate (ISO8601_DATE_OFFSET_COLON );
82+ Date gitlabMsecDate = ISO8601 .toDate (ISO8601_DATE_MSEC_OFFSET_COLON );
7483 assertEquals (msecDate , gitlabMsecDate );
7584 }
7685}
You can’t perform that action at this time.
0 commit comments