Problem/Motivation

We have multilingual content and created one feed for all language contents. By setting the language to match the interface language, we essentially have a feed per language (/en/news/feed, /ja/news/feed, etc) with just one single Feed display.

We expect the non-English feed to have the RFC-822 formatted date in English, but they turned out translated, and thus not RFC-822 compliant any more:

Japanese date

Japanese date

Steps to reproduce

1. Create a feed in a view of a multilingual site.
2. Filter the feed by language = interface language.

Proposed resolution

Is there a native or custom hook we can use to force the date format to use RFC-822 formatting?

Comments

hktang created an issue. See original summary.

hktang’s picture

Title: pubDate formatting in non-English sites » pubDate formatting in non-English sites is not RFC-822 compliant
hktang’s picture

Issue summary: View changes
idebr’s picture

You can delete the localization for the rfc822 date format, so it matches the default format: https://git.drupalcode.org/project/views_rss/-/blob/8.x-2.x/config/insta...

hktang’s picture

Thank you very much for the pointer. I deleted the translations for days of week and month names, and the pubDate is correctly picked up by the reader I tested with.

It seems the year format (like 2026) has been shortened (26). Is there a translation string that we can unset?

Also, I have not evaluated whether other parts of our system uses those translations -- so far it looks fine though... In case they are used elsewhere, another approach may be needed. Is there a native/custom hook we can use to alter this behavior?

idebr’s picture

The date format was introduced in #3413726: Date values should be in RFC-822 format, not RFC-2822 specifically for RSS, so it is probably safe to change the year formatting in your installation.

There is an issue available to change the year format to 4 digits programmatically, see #3492994: pubDate has invalid year format

besek’s picture

I have the same issue with the date being formatted in Polish:
ndz., 29 mar 2026 20:31:33 +0200
(this is after I already changed year from 2-digits to 4-digits)
But the issue with name of the day and month remains and is causing errors in newsreaders.

Deleting rfc822 core.date_format.rfc822 is not helping.

What is interesting, the channel lastBuildDate is correct, but the items pubDate is in the wrong format

dariemlazaro’s picture

StatusFileSize
new47.61 KB
new49.14 KB

I ran into the same problem and found a partial solution.
Set the custom format for RFC-822 to "D, d M Y H:i:s O"

date format

Then I overwrite the field output with the Twig date() filter that forces the use of English.

view twig

With that, the elements are translated correctly, but the channel date doesn't seem to show the year with 4 digits.

<generator>Drupal 10</generator>
<ttl>5</ttl>
<lastBuildDate>Mon, 13 Apr 2026 09:17:32 -0400</lastBuildDate>
<pubDate>Fri, 10 Apr 26 12:57:59 -0400</pubDate>

Taking this into account, to avoid date translations in elements, simply add/modify a tpl (twig) with the date() filter on the module. The only remaining step is to format the year to 4 digits in the channel date.