diff --git a/app/src/main/java/info/nightscout/utils/DateUtil.java b/app/src/main/java/info/nightscout/utils/DateUtil.java index 3e32557adb..1e399ddd58 100644 --- a/app/src/main/java/info/nightscout/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/utils/DateUtil.java @@ -27,8 +27,8 @@ public class DateUtil { /** * The date format in iso. */ - private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ss'Z'"; - private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ"; + private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; /** * Takes in an ISO date string of the following format: diff --git a/app/src/test/java/info/nightscout/utils/DateUtilTest.java b/app/src/test/java/info/nightscout/utils/DateUtilTest.java new file mode 100644 index 0000000000..f269253ba8 --- /dev/null +++ b/app/src/test/java/info/nightscout/utils/DateUtilTest.java @@ -0,0 +1,25 @@ +package info.nightscout.utils; + + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Created by mike on 20.11.2017. + */ + +public class DateUtilTest { + + public DateUtilTest() { + super(); + } + + @Test + public void fromISODateStringTest() throws Exception { + assertEquals( 1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime()); + assertEquals( 1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime()); + } + + +}