diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2017-12-11 20:13:25 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2017-12-11 20:13:25 +0100 |
commit | 95f5085a91be1a360f758e6e990c10d2a5dc128f (patch) | |
tree | ea85532a997862cea51392299a26ec75c03cd9e4 /core | |
parent | dfa5066de7044c39c394fe0828d03eb236c9f887 (diff) | |
parent | 42cd7ea8020f2ec549bdab92919171d026611019 (diff) | |
download | AntennaPod-95f5085a91be1a360f758e6e990c10d2a5dc128f.zip |
Merge remote-tracking branch 'origin/develop' into develop
Diffstat (limited to 'core')
-rw-r--r-- | core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java | 8 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java index 8adcc41c5..ee90d9116 100644 --- a/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java @@ -130,4 +130,12 @@ public class DateUtilsTest extends AndroidTestCase { Date actual = DateUtils.parse("Thu, 8 Oct 2014 09:00:00 GMT"); // actually a Wednesday assertEquals(expected, actual); } + + public void testParseDateWithBadAbbreviation() { + GregorianCalendar exp1 = new GregorianCalendar(2014, 8, 8, 0, 0, 0); + exp1.setTimeZone(TimeZone.getTimeZone("GMT")); + Date expected = new Date(exp1.getTimeInMillis()); + Date actual = DateUtils.parse("Mon, 8 Sept 2014 00:00:00 GMT"); // should be Sep + assertEquals(expected, actual); + } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java index f63f0983f..5056ea274 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java @@ -31,6 +31,9 @@ public class DateUtils { date = date.replaceAll("CEST$", "+02:00"); date = date.replaceAll("CET$", "+01:00"); + // some generators use "Sept" for September + date = date.replaceAll("\\bSept\\b", "Sep"); + // if datetime is more precise than seconds, make sure the value is in ms if (date.contains(".")) { int start = date.indexOf('.'); |