diff --git a/app/src/main/java/com/readrops/app/utils/DateUtils.java b/app/src/main/java/com/readrops/app/utils/DateUtils.java index a2302145..6577c885 100644 --- a/app/src/main/java/com/readrops/app/utils/DateUtils.java +++ b/app/src/main/java/com/readrops/app/utils/DateUtils.java @@ -21,6 +21,8 @@ public final class DateUtils { private static final String OFFSET_PATTERN = "Z"; + private static final String ISO_PATTERN = ".SSSZZ"; + /** * Date pattern for format : 2019-01-04T22:21:46+00:00 */ @@ -32,6 +34,7 @@ public final class DateUtils { .appendOptional(DateTimeFormat.forPattern(ATOM_JSON_DATE_FORMAT).getParser()) .appendOptional(DateTimeFormat.forPattern(GMT_PATTERN).getParser()) .appendOptional(DateTimeFormat.forPattern(OFFSET_PATTERN).getParser()) + .appendOptional(DateTimeFormat.forPattern(ISO_PATTERN).getParser()) .toFormatter() .withLocale(Locale.ENGLISH) .withOffsetParsed(); diff --git a/app/src/test/java/com/readrops/app/DateUtilsTest.java b/app/src/test/java/com/readrops/app/DateUtilsTest.java index 3ecfc545..2cb8ac2a 100644 --- a/app/src/test/java/com/readrops/app/DateUtilsTest.java +++ b/app/src/test/java/com/readrops/app/DateUtilsTest.java @@ -41,4 +41,12 @@ public class DateUtilsTest { assertEquals(0, dateTime.compareTo(DateUtils.stringToLocalDateTime("2019-01-04T22:21:46-0000"))); } + + @Test + public void isoPatternTest() { + LocalDateTime dateTime = new LocalDateTime(2020, 6, 30, 11, 39, 37, 206); + + + assertEquals(0, dateTime.compareTo(DateUtils.stringToLocalDateTime("2020-06-30T11:39:37.206-07:00"))); + } } \ No newline at end of file