diff options
author | Herbert Reiter <46045854+damoasda@users.noreply.github.com> | 2021-01-02 12:59:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-02 12:59:26 +0100 |
commit | 0b715d549483840de1f12c07892904092c49c3e9 (patch) | |
tree | be5fb2fa98a2fa29a266b216faa71d9568551e28 /core/src/main | |
parent | b1dc96adb3107d2ecb689c213629ee1e11f26ba8 (diff) | |
download | AntennaPod-0b715d549483840de1f12c07892904092c49c3e9.zip |
Run DateUtilsTest as Unit Test (#4805)
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java | 7 |
1 files changed, 5 insertions, 2 deletions
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 833ff33f1..196583bcd 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 @@ -30,9 +30,12 @@ public class DateUtils { } String date = input.trim().replace('/', '-').replaceAll("( ){2,}+", " "); + // remove colon from timezone to avoid differences between Android and Java SimpleDateFormat + date = date.replaceAll("([+-]\\d\\d):(\\d\\d)$", "$1$2"); + // CEST is widely used but not in the "ISO 8601 Time zone" list. Let's hack around. - date = date.replaceAll("CEST$", "+02:00"); - date = date.replaceAll("CET$", "+01:00"); + date = date.replaceAll("CEST$", "+0200"); + date = date.replaceAll("CET$", "+0100"); // some generators use "Sept" for September date = date.replaceAll("\\bSept\\b", "Sep"); |