Hi,

I know change, format_date() to gmdate().
by Revision 1.947.2.7

but, local time, it does not.

If gmdate('r', $item->created) is return GMT/UTC Time.

If date('r', $item->created) is returan Local time.

I think so. date('r', $item->created)

Thank you

CommentFileSizeAuthor
#7 jsomers_254444_1-D7.patch876 bytesj.somers

Comments

macgirvin’s picture

subscribe

pasqualle’s picture

Version: 6.2 » 7.x-dev
Priority: Critical » Normal
slampy’s picture

Why this issue has been moved to the 7.x branch?

This is certainly a bug fix not a new feature request.

It would be great to be committed to the 6.x branch.

pasqualle’s picture

1. It is marked as feature request, so I automatically moved it to the latest development version..
http://drupal.org/node/73179

Note that new features are generally only accepted for the latest development version code unless they are very important. Even if it seems important to you, it has to be important for a large number of sites to be worth creating a fix for a currently released version of Drupal. You cannot get around this rule by simply labeling a feature request as a bug request. If you want to get a feature applied to a released version of Drupal you need to make the case that it is important, affects a large number of sites, and ensure that the code changed is stable.

2. Every issue should be fixed in the latest development version first and then backported.

j.somers’s picture

Can someone explain the issue a bit clearer? I cannot find a reference to date() in node_feed() and it should definitely not use the local time when setting the date of a feed item so I don't really see what's wrong with it.

slampy’s picture

The source of this issue is that Drupal uses the gmdate() PHP function that returns GMT/UTC time, which won't give a valid RSS feed unless you just use this timezone. The solution is to change this to the date() function and this solves this issue.

This issue appears in Views as well, but they won't change it until it is fixed in Drupal core.
I always manually edited each of my Drupal sites to fix this problem. :-(

To fix this just go to /modules/node/node.module and replace this line:
$extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => gmdate('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false'))));

With:
$extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false'))));

j.somers’s picture

Status: Active » Needs review
StatusFileSize
new876 bytes

Attached is a patch for D7 as suggested in #6.

I see that gmdate() is also used in the following files:

jensen@atlantis:/var/www/drupal$ grep -lir "gmdate" *
includes/xmlrpc.inc
includes/bootstrap.inc
modules/aggregator/aggregator.pages.inc
modules/aggregator/aggregator.fetcher.inc
modules/aggregator/tests/aggregator_test.module
modules/simpletest/tests/bootstrap.test

I don't know whether any of these gmdate() usages are subject to the same issue.

damien tournoud’s picture

Status: Needs review » Postponed (maintainer needs more info)

Why do we want to use the local time there? Why does that make an "invalid feed"?

slampy’s picture

I am not a great technical guy. I have a website and when I wanted my news to appear in an RSS reader they told me, that my RSS feeds are not valid, because of the PubDate timestamp.

What I know for sure that most of the Hungarian websites use this format. For example the biggest news site:
http://index.hu/24ora/rss/

Example:

Tue, 02 Jun 2009 11:53:00 +0200

This is done by date() and not gmdate().

mfb’s picture

@slampy, that seems like a problem with the RSS reader, not Drupal. The RSS reader should not require the dates to use a particular time zone. Any RSS reader I've seen translates all the dates into the local time zone of the person who's using the reader.

neclimdul’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

GMT seems like the desired output actually. GMT is a fairly standard time zone and the output follows the specification.

The publication date for the content in the channel. For example, the New York Times publishes on a daily basis, the publication date flips once every 24 hours. That's when the pubDate of the channel changes. All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).
- http://cyber.law.harvard.edu/rss/rss.html

RFC 822 Data and Time Specification: http://asg.web.cmu.edu/rfc/rfc822.html#sec-5

Just to make sure I did some more research and it seems that wordpress, and joomla both use this pubDate as GMT functionality however zend changed it to the suggested local time rather recently. Curiosity peeked, I found that there is actually a replacement RFC for 822(2822) that changes the wording to specify local time.

Even so RFC 822 dates as GMT seem to be the overwhelming standard. Furthermore, RFC 2822 was published before the RSS 2.0 specification but the wording specifically references the earlier RFC 822. So seems to me Drupal is doing the right thing here unless we can get specific reasons this is incorrect.

johnmunro’s picture

Previous comment was incorrect. Local settings had been changed! Sorry.

rudiedirkx’s picture

My problem isn't the timezone, but the date format. D, d M Y H:i:s T is correct, but it's rendered as Dutch (in this case), so D will be "wo" instead of "Wed".

Readers don't get that.

The date should be English, always, whatever the current locale. I couldn't care less about a few hours offset. Dutch people read Dutch feeds, Americans American feeds and Chinese Chinese feeds etc.

damien tournoud’s picture

@rudiedirkx: Drupal feeds are going to output the proper date format, regardless of the locale of the site. Do you have an example of a case in which it fails?

damien tournoud’s picture

@rudiedirkx: Also, if you are using Drupal 6, you might be bumping into #614124: Bootstrap should reset locale settings. Help review the patch there.