Mercurial > emacs
diff lisp/calendar/icalendar.el @ 93376:bc4871e6df44
(icalendar--datetime-to-american-date): New name for
icalendar--datetime-to-noneuropean-date. Make old name obsolete alias.
(icalendar--datetime-to-iso-date): New function.
(icalendar--datetime-to-diary-date): Doc fix. Respect
calendar-date-style if bound.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 29 Mar 2008 02:44:44 +0000 |
parents | fe7a1170342d |
children | adddea858c0d |
line wrap: on
line diff
--- a/lisp/calendar/icalendar.el Sat Mar 29 02:44:24 2008 +0000 +++ b/lisp/calendar/icalendar.el Sat Mar 29 02:44:44 2008 +0000 @@ -624,11 +624,11 @@ ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME? ))) -(defun icalendar--datetime-to-noneuropean-date (datetime &optional separator) - "Convert the decoded DATETIME to non-european-style format. +(defun icalendar--datetime-to-american-date (datetime &optional separator) + "Convert the decoded DATETIME to American-style format. Optional argument SEPARATOR gives the separator between month, day, and year. If nil a blank character is used as separator. -Non-European format: \"month day year\"." +American format: \"month day year\"." (if datetime (format "%d%s%d%s%d" (nth 4 datetime) ;month (or separator " ") @@ -638,6 +638,9 @@ ;; datetime == nil nil)) +(define-obsolete-function-alias 'icalendar--datetime-to-noneuropean-date + 'icalendar--datetime-to-american-date "icalendar 0.19") + (defun icalendar--datetime-to-european-date (datetime &optional separator) "Convert the decoded DATETIME to European format. Optional argument SEPARATOR gives the separator between month, @@ -653,15 +656,33 @@ ;; datetime == nil nil)) +(defun icalendar--datetime-to-iso-date (datetime &optional separator) + "Convert the decoded DATETIME to ISO format. +Optional argument SEPARATOR gives the separator between month, +day, and year. If nil a blank character is used as separator. +ISO format: (year month day)." + (if datetime + (format "%d%s%d%s%d" (nth 5 datetime) ;year + (or separator " ") + (nth 4 datetime) ;month + (or separator " ") + (nth 3 datetime)) ;day + ;; datetime == nil + nil)) + (defun icalendar--datetime-to-diary-date (datetime &optional separator) "Convert the decoded DATETIME to diary format. Optional argument SEPARATOR gives the separator between month, day, and year. If nil a blank character is used as separator. -Call icalendar--datetime-to-(non)-european-date according to -value of `european-calendar-style'." - (if european-calendar-style - (icalendar--datetime-to-european-date datetime separator) - (icalendar--datetime-to-noneuropean-date datetime separator))) +Call icalendar--datetime-to-*-date according to the +value of `calendar-date-style' (or the older `european-calendar-style')." + (funcall (intern-soft (format "icalendar--datetime-to-%s-date" + (if (boundp 'calendar-date-style) + calendar-date-style + (if (with-no-warnings european-calendar-style) + 'european + 'american)))) + datetime separator)) (defun icalendar--datetime-to-colontime (datetime) "Extract the time part of a decoded DATETIME into 24-hour format.