summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-05-20 20:25:12 +0200
committerGitHub <noreply@github.com>2024-05-20 20:25:12 +0200
commitfc1c13f4a5fa60646bd3c3be376b009b026c6da2 (patch)
tree2cb003de9ff8e78a68de3f33de0b04e54c01aac9
parent84b6f442fcf3ffa6921d5e1ac29233efe88d0526 (diff)
downloadAntennaPod-fc1c13f4a5fa60646bd3c3be376b009b026c6da2.zip
Add new date format (#7189)
-rw-r--r--parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java1
-rw-r--r--parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/util/DateUtilsTest.java9
2 files changed, 10 insertions, 0 deletions
diff --git a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
index dbddb44b0..331741b05 100644
--- a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
+++ b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
@@ -92,6 +92,7 @@ public abstract class DateUtils {
"EEE MMM d HH:mm yyyy",
"yyyy-MM-dd'T'HH:mm:ss",
"yyyy-MM-dd'T'HH:mm:ss.SSS Z",
+ "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
"yyyy-MM-dd'T'HH:mm:ss.SSS",
"yyyy-MM-dd'T'HH:mm:ssZ",
"yyyy-MM-dd'T'HH:mm:ss'Z'",
diff --git a/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/util/DateUtilsTest.java b/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/util/DateUtilsTest.java
index 1f039d703..874a47c38 100644
--- a/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/util/DateUtilsTest.java
+++ b/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/util/DateUtilsTest.java
@@ -34,6 +34,15 @@ public class DateUtilsTest {
}
@Test
+ public void testParseDateWithZuluTimezone() {
+ GregorianCalendar exp = new GregorianCalendar(2024, 4, 8, 22, 18, 52);
+ exp.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Date expected = new Date(exp.getTimeInMillis() + 485);
+ Date actual = DateUtils.parse("2024-05-08T22:18:52.485Z");
+ assertEquals(expected, actual);
+ }
+
+ @Test
public void testParseDateWithDeciseconds() {
GregorianCalendar exp = new GregorianCalendar(2015, 2, 28, 13, 31, 4);
exp.setTimeZone(TimeZone.getTimeZone("UTC"));