зеркало из https://github.com/mozilla/pjs.git
Bug 512307 - Recognize and parse RFC 822 dates that use "Z" as a timezone, r=mak
This commit is contained in:
Родитель
9eca2cdf11
Коммит
f88c822174
|
@ -873,6 +873,9 @@ function rssArrayElement(s) {
|
|||
*/
|
||||
function dateParse(aDateString) {
|
||||
let dateString = aDateString.trim();
|
||||
// Without bug 682781 fixed, JS won't parse an RFC822 date with a Z for the
|
||||
// timezone, so convert to -00:00 which works for any date format.
|
||||
dateString = dateString.replace(/z$/i, "-00:00");
|
||||
let date = new Date(dateString);
|
||||
if (!isNaN(date)) {
|
||||
return date.toUTCString();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!--
|
||||
|
||||
Description: Test whether date parsing handles "Z" as a timezone in RFC822.
|
||||
Expect: feed.updated == 'Tue, 25 Apr 2006 08:00:00 GMT'
|
||||
|
||||
-->
|
||||
<rss version="2.0" >
|
||||
<channel>
|
||||
<pubDate>Tue, 25 Apr 2006 08:00:00 Z</pubDate>
|
||||
</channel>
|
||||
</rss>
|
Загрузка…
Ссылка в новой задаче