Opened 16 years ago
Closed 15 years ago
#101 closed defect (fixed)
RSS pubDate uses invalid date-time format
Reported by: | mattblanchette | Owned by: | heikki |
---|---|---|---|
Priority: | major | Milestone: | v2.4.0 RC2 |
Component: | General | Version: | v2.2.0 Final |
Keywords: | RSS, pubDate, date, time | Cc: |
Description
RSS generated by rss-utils.xsl contains pubDate with invalid date-time format yyyy-MM-ddTHH:mm:ss. This causes timestamps to be incorrect for different timezones.
The RSS pubDate should follow the RFC-822 Date and Time specifications (dd mm yy hh:mm:ss zzz), so the format "2009-04-21T00:00:01" would be "21 Apr 2009 00:00:01 EST", with the zone value depending on the appropriate timezone.
Here is my workaround for rss-utils.xsl:
Before:
<pubDate><xsl:value-of select="geonet:info/changeDate"/></pubDate>
After:
<xsl:variable name="date" select="geonet:info/changeDate"/>
<xsl:variable name="day" select="substring($date,9,2)" />
<xsl:variable name="monthnumber" select="substring($date,6,2)" />
<xsl:variable name="year" select="substring($date,1,4)" />
<xsl:variable name="time" select="substring($date,12)" />
<xsl:variable name="month">
<xsl:choose>
<xsl:when test="$monthnumber='01'">
<xsl:value-of select="'Jan'" />
</xsl:when>
<xsl:when test="$monthnumber='02'">
<xsl:value-of select="'Feb'" />
</xsl:when>
<xsl:when test="$monthnumber='03'">
<xsl:value-of select="'Mar'" />
</xsl:when>
<xsl:when test="$monthnumber='04'">
<xsl:value-of select="'Apr'" />
</xsl:when>
<xsl:when test="$monthnumber='05'">
<xsl:value-of select="'May'" />
</xsl:when>
<xsl:when test="$monthnumber='06'">
<xsl:value-of select="'Jun'" />
</xsl:when>
<xsl:when test="$monthnumber='07'">
<xsl:value-of select="'Jul'" />
</xsl:when>
<xsl:when test="$monthnumber='08'">
<xsl:value-of select="'Aug'" />
</xsl:when>
<xsl:when test="$monthnumber='09'">
<xsl:value-of select="'Sep'" />
</xsl:when>
<xsl:when test="$monthnumber='10'">
<xsl:value-of select="'Oct'" />
</xsl:when>
<xsl:when test="$monthnumber='11'">
<xsl:value-of select="'Nov'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Dec'" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<pubDate><xsl:value-of select="concat($day,' ',$month,' ',$year,' ',$time,' EST'))"/></pubDate>
Change History (2)
comment:1 by , 15 years ago
Milestone: | → v2.4.0 RC2 |
---|---|
Owner: | changed from | to
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Applied and tested the provided fix.