A Matter of Time
October 9, 2019
Several weeks ago, when I started to add a JSON
feed to tumblelog
I
had to consider what time stamp to use for date_published
. As I blog
often more than once during the day, and all such entries end up on
the same page, there is no specific publication time to assign to
such a page. Well, technically I could keep track of the last time the
page was modified, but that would make tumblelog
more complex, and I
like to keep it a simple program. And while date_published
is
optional in a JSON feed I preferred to give it a value.
So, at first I just set date_published
to just the date of the day I
had published the blog entries on. Last week, when validating the
JSON feed I learned that that's not
a valid value for date_published
; oops.
Also last week, upon reading the RSS specification, another more known
feed format, I noticed the following note associated with the
pubDate
sub-element:
Its value is a date, indicating when the item was published. If it's a date in the future, aggregators may choose to not display the item until that date.
This led me to the idea of using the end of the day as the publication date. Or: I blog during the day, and at the end of the day all entries are considered published.
This decided I started to add RSS feed support to both the Perl and
Python version of tumblelog
.
The only downside, so far, is that the Feed Validator reports for the RSS feed:
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
- line 1, column 502: Implausible date: Wed, 09 Oct 2019 23:59:59 +0200
I tested both the JSON feed and RSS feed in Reeder and NetNewsWire on macOS Mojave and both have no problem handling the feeds of my tumblelog Plurrrr.
After having decided to use the end of the day as publication time came the next task: encoding the local date and time in the correct format. A JSON feed uses RFC #3339 while RSS uses RFC #822.