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 {
28
28
public static final String UTC_PATTERN = "yyyy-MM-dd HH:mm:ss 'UTC'" ;
29
29
30
30
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 ]]" )
32
32
.parseDefaulting (ChronoField .HOUR_OF_DAY , 0 )
33
33
.parseDefaulting (ChronoField .MINUTE_OF_HOUR , 0 )
34
34
.parseDefaulting (ChronoField .SECOND_OF_MINUTE , 0 )
Original file line number Diff line number Diff line change @@ -20,8 +20,10 @@ public class TestISO8601 {
20
20
private static final String SPACEY_GITLAB_DATE_WITH_MSEC = "2018-03-12 10:16:46.123 +0700" ;
21
21
private static final String ISO8601_GITLAB_DATE_WITH_MSEC ="2018-03-12T10:16:46.123+0700" ;
22
22
23
+ private static final String ISO8601_DATE_OFFSET_COLON = "2018-03-12T10:16:46+07:00" ;
24
+
23
25
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" ;
25
27
private static final String ISO8601_GITLAB_DATE_MSEC = "2018-03-12T03:16:46.123-0700" ;
26
28
private static final String SPACEY_GITLAB_UTC_DATE_MSEC = "2018-03-12 10:16:46.123 UTC" ;
27
29
@@ -69,8 +71,15 @@ public void testMsecDateParse() throws ParseException {
69
71
70
72
@ Test
71
73
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 {
72
81
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 );
74
83
assertEquals (msecDate , gitlabMsecDate );
75
84
}
76
85
}
You can’t perform that action at this time.
0 commit comments