mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-31 02:44:53 +01:00
Merge pull request #2474 from shantanahardy/develop
Parse RSS pubDate fields containing "Sept"
This commit is contained in:
commit
42cd7ea802
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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('.');
|
||||
|
Loading…
x
Reference in New Issue
Block a user