Commit ac4c237c authored by Miles Bader's avatar Miles Bader
Browse files

(timezone-parse-date): Handle ISO 8601 dates, so rmailsort does the right

  thing with them.
parent 98aac09d
;;; timezone.el --- time zone package for GNU Emacs ;;; timezone.el --- time zone package for GNU Emacs
;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. ;; Copyright (C) 1990, 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
;; Author: Masanobu Umeda ;; Author: Masanobu Umeda
;; Maintainer: umerin@mse.kyutech.ac.jp ;; Maintainer: umerin@mse.kyutech.ac.jp
...@@ -131,7 +131,8 @@ Understands the following styles: ...@@ -131,7 +131,8 @@ Understands the following styles:
(5) 22-AUG-1993 10:59:12.82 (5) 22-AUG-1993 10:59:12.82
(6) Thu, 11 Apr 16:17:12 91 [MET] (6) Thu, 11 Apr 16:17:12 91 [MET]
(7) Mon, 6 Jul 16:47:20 T 1992 [MET]" (7) Mon, 6 Jul 16:47:20 T 1992 [MET]"
;; Get rid of any text properties. (8) 1996-06-24 21:13:12 [GMT]"
;; Get rid of any text properties.
(and (stringp date) (and (stringp date)
(or (text-properties-at 0 date) (or (text-properties-at 0 date)
(next-property-change 0 date)) (next-property-change 0 date))
...@@ -175,6 +176,14 @@ Understands the following styles: ...@@ -175,6 +176,14 @@ Understands the following styles:
"\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\.[0-9]+" date) "\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\.[0-9]+" date)
;; Styles: (5) without timezone. ;; Styles: (5) without timezone.
(setq year 3 month 2 day 1 time 4 zone nil)) (setq year 3 month 2 day 1 time 4 zone nil))
((string-match
"\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)[ \t]*\\([-+a-zA-Z0-9]+\\)" date)
;; Styles: (8) with timezone.
(setq year 1 month 2 day 3 time 4 zone 5))
((string-match
"\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)" date)
;; Styles: (8) without timezone.
(setq year 1 month 2 day 3 time 4 zone nil))
) )
(if year (if year
(progn (progn
...@@ -183,13 +192,17 @@ Understands the following styles: ...@@ -183,13 +192,17 @@ Understands the following styles:
;; It is now Dec 1992. 8 years before the end of the World. ;; It is now Dec 1992. 8 years before the end of the World.
(if (< (length year) 4) (if (< (length year) 4)
(setq year (concat "19" (substring year -2 nil)))) (setq year (concat "19" (substring year -2 nil))))
(let ((string (substring date (setq month
(match-beginning month) (if (= (aref date (+ (match-beginning month) 2)) ?-)
(+ (match-beginning month) 3)))) ;; Handle numeric months, spanning exactly two digits.
(setq month (substring date
(int-to-string (match-beginning month)
(cdr (assoc (upcase string) timezone-months-assoc))))) (+ (match-beginning month) 2))
(let ((string (substring date
(match-beginning month)
(+ (match-beginning month) 3))))
(int-to-string
(cdr (assoc (upcase string) timezone-months-assoc))))))
(setq day (setq day
(substring date (match-beginning day) (match-end day))) (substring date (match-beginning day) (match-end day)))
(setq time (setq time
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment