Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Martin Fietz 2017-12-11 20:13:25 +01:00
commit 95f5085a91
2 changed files with 11 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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('.');