[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

sb-rss.el and ISO 8601 date



Hallo,

while hacking on a shimbun backend I stumbled over a site[1] whose rss
date format didn't get parsed properly by sb-rss.el:

"2004-06-13T01:55+0200"

sb-rss.el says:
  ;; make Date string from ISO 8601 date format.  See
  ;; http://www.w3.org/TR/NOTE-datetime.

Above date is a correct[2] ISO 8601 date, but W3C seems to command an
additional colon in the timezone.

The patch below makes sb-rss.el also accept the ISO 8601 version
without colon, without introducing ambiguity.

thanks
Andreas

[1] http://www.welt.de/z/newsticker/ticker_welt.xml
[2] according to this interpretation of the standard:
    <http://www.cl.cam.ac.uk/~mgk25/iso-time.html>

RCS file: /storage/cvsroot/emacs-w3m/shimbun/sb-rss.el,v
retrieving revision 1.17
diff -u -r1.17 sb-rss.el
--- sb-rss.el   5 May 2004 23:00:43 -0000       1.17
+++ sb-rss.el   13 Jun 2004 00:24:31 -0000
@@ -76,7 +76,7 @@
   ;;      hh   = two digits of hour (00 through 23) (am/pm NOT allowed)
   (let (year month day minutes timezone)
     (if (or (null date) (not (string-match
-             "\\([0-9][0-9][0-9][0-9]\\)\\(-[0-9][0-9]\\)?\\(-[0-9][0-9]\\)?T?\\([0-9][0-9]:[0-9][0-9]\\(:[.0-9]+\\)?\\)?\\(\\+[0-9][0-9]:[0-9][0-9]\\|Z\\)?"
+             "\\([0-9][0-9][0-9][0-9]\\)\\(-[0-9][0-9]\\)?\\(-[0-9][0-9]\\)?T?\\([0-9][0-9]:[0-9][0-9]\\(:[.0-9]+\\)?\\)?\\(\\+[0-9][0-9]:?[0-9][0-9]\\|Z\\)?"
              date)))
        ""
       (setq year (match-string-no-properties 1 date)