| Project: | Views RSS |
| Version: | 7.x-2.0-rc3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
In order to conform to the standard date for RSS, it's necessary the date format of: D, d M Y H:i:s T
When Drupal is not configured for English, the above date format produces a non-conforming date for RSS feeds as "Mon" for Monday in English then becomes "Lun" in Italian for example. Ideally, the Date module would provide a number formatted for DATE_RSS, but as there are 500+ issues in the queue, I don't think it's going to be done anytime soon.
Can we look at a way of implementing this feature into Views RSS, allowing for international sites to also use this excellent module?
Here is a quick hack I implimented recently: (the format for the date I am using does not have the time, just the date so I filled in the time with 17:00:00
// Expects a date begining with the formatting: YYYY-MM-DD (2010-10-28)
$timestamp = mktime(17, 0, 0, substr($item['pubDate'], 5, 2), substr($item['pubDate'], 8, 2), substr($item['pubDate'], 0, 4));
$item['pubDate'] = date(DATE_RSS, $timestamp);
Comments
#1
Sorry, mine issue is a duplicate of http://drupal.org/node/703980
#2
i feel a bit not too smart, but where did you apply your hack? in the views_rss module?
I tried everything and my view keeps on returning
<pubDate>Tue, 2011-07-19</pubDate>which doesnt validate for the feed, no idea where to change it.
#3
I don't think it's a duplicate and it's still present in D7.
#4
Here's a quickfix:
Make a template. Mine is
/sites/all/themes/fluffytoys/templates/views-view-field--nodequeue-2--feed-2--created.tpl.phpand make it say
<?phpprint date('r', $row->node_created);
?>
This will probably give you a valid, english RFC 822 compliant date.
If not
<?phpsetlocale(LC_ALL, "en_US");
print date('r', $row->node_created);
setlocale(LC_ALL, "nl_NL");
?>
might help.
Testing: paste the preview from views into
http://validator.w3.org/feed/#validate_by_input
to check if you're getting RFC 822 right
Further reading:
http://php.net/manual/en/function.date.php
http://php.net/manual/en/function.setlocale.php
#5
@ MauMau or anyone - will the template suggestion in #4 work for 6.x-2.0-rc3?
Thanks
#6
#4 works for me in 7.x.
#7
@ Plazik or anyone - sorry for being thick but does #4 give the entire tpl.php file or just a part of it?
Thanks
#8
Juc1, it's full tpl.php file.
#9
@ Plazik, sorry is this the entire file??
<?phpprint date('r', $row->node_created);
?>
Thanks
#10
Yeah.
#11
OK thanks - but last thing can you please tell me how I work out the name of the template instead of
views-view-field--nodequeue-2--feed-2--created.tpl.php ?
Thank you
#12
Why instead of?
Use the name what Views tell you. My name like this views-view-field--nodequeue-2--feed-2--created.tpl.php
#13
I got stuck with this issue as well but after setting the field to 'Custom date format' and placing
rin the field it now shows up as the RFC822 date-time format and my feeds validates in the w3c feed validator.So I think you can call this fixed although it would be nice to set it to the english version by default.
For reference I've included a screenshot:

As a site note I'm using Views 7.x-3.5 but I think that it is fixed or can be fixed by using the described method. If not reopen the issue.
#14
Automatically closed -- issue fixed for 2 weeks with no activity.