diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-09-27 16:30:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 16:30:05 +0200 |
commit | 5a4219bf09aac249477958f2ba725999215e6265 (patch) | |
tree | 776533f6f846b7ca49a5e9eb4ae6e97dedb54808 /core | |
parent | 20367fd240ca3089ccbb39c6b616690ae6b0ea11 (diff) | |
parent | 1796b5d739ae32e41cc9b2abf3f84394f138d415 (diff) | |
download | AntennaPod-5a4219bf09aac249477958f2ba725999215e6265.zip |
Merge pull request #2802 from 1nsidE/develop
[#2801] (AntennaPod failing to parse date in "Sun 01 Mar 2015 01:00:00 GMT-0400 (EDT)" format)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java | 9 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java index d5efdbc24..bef83b060 100644 --- a/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.util; import android.test.AndroidTestCase; +import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; @@ -156,4 +157,12 @@ public class DateUtilsTest extends AndroidTestCase { Date actual = DateUtils.parse("Mon, 8 Sept 2014 00:00:00 GMT"); // should be Sep assertEquals(expected, actual); } + + public void testParseDateWithTwoTimezones() { + final GregorianCalendar exp1 = new GregorianCalendar(2015, Calendar.MARCH, 1, 1, 0, 0); + exp1.setTimeZone(TimeZone.getTimeZone("GMT-4")); + final Date expected = new Date(exp1.getTimeInMillis()); + final Date actual = DateUtils.parse("Sun 01 Mar 2015 01:00:00 GMT-0400 (EDT)"); + 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 5056ea274..e17d8de3e 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 @@ -85,7 +85,8 @@ public class DateUtils { "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-ddZ", - "yyyy-MM-dd" + "yyyy-MM-dd", + "EEE d MMM yyyy HH:mm:ss 'GMT'Z (z)" }; SimpleDateFormat parser = new SimpleDateFormat("", Locale.US); |