Subject: | Date format invalidates atom feeds |
Atom feeds should use the RFC 3339 date time format as described here (
http://validator.w3.org/feed/docs/error/InvalidRFC3339Date.html ).
Otherwise the feed cannot be validated against the W3C validation
service ( http://validator.w3.org/feed/ ).
Currently Atom feeds seem to lack the timezone information (except for
<published>).
Minimal example
-------8<---------
use DateTime;
use XML::Feed; use XML::Feed::Entry;
my $feed = XML::Feed->new('Atom');
my $dt = DateTime->now();
$feed->title("My Atom feed");
$feed->link("http://www.example.com");
$feed->author("Author");
$feed->updated($dt);
$feed->id("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344eaa6a");
my $entry = XML::Feed::Entry->new('Atom');
$entry->title("An important event");
$entry->author("Important author");
$entry->content("A very interesting event happened.");
$entry->issued($dt);
$entry->updated($dt);
$entry->id("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a");
$feed->add_entry($entry);
print $feed->as_xml . "\n";
------->8----------
Yields:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>My Atom feed</title>
<link rel="alternate" href="http://www.example.com" type="text/html"/>
<author>
<name>Author</name>
</author>
<updated>2009-07-31T00:17:29</updated>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344eaa6a</id>
<entry>
<title>An important event</title>
<author>
<name>Important author</name>
</author>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">A very interesting event
happened.</div>
</content>
<published>2009-07-31T00:17:29Z</published>
<updated>2009-07-31T00:17:29</updated>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
</entry>
</feed>
Validator fails with above output complaining about the dates of <updated>.