aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-03-29 02:44:44 +0000
committerGlenn Morris2008-03-29 02:44:44 +0000
commitf905ff0d8f2c548a308c1c37ae0679f926444f7a (patch)
treeaf0640cd2ef6b21522899e3504c1f764336a5dc7
parentcc4b5cd31cc2a8a5821f903826daee60490a5ef1 (diff)
downloademacs-f905ff0d8f2c548a308c1c37ae0679f926444f7a.tar.gz
emacs-f905ff0d8f2c548a308c1c37ae0679f926444f7a.zip
(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.
-rw-r--r--lisp/calendar/icalendar.el37
1 files changed, 29 insertions, 8 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 7b7b7092302..6c4469afdbd 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -624,11 +624,11 @@ valid (year > 1900 or something)."
624 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME? 624 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME?
625 ))) 625 )))
626 626
627(defun icalendar--datetime-to-noneuropean-date (datetime &optional separator) 627(defun icalendar--datetime-to-american-date (datetime &optional separator)
628 "Convert the decoded DATETIME to non-european-style format. 628 "Convert the decoded DATETIME to American-style format.
629Optional argument SEPARATOR gives the separator between month, 629Optional argument SEPARATOR gives the separator between month,
630day, and year. If nil a blank character is used as separator. 630day, and year. If nil a blank character is used as separator.
631Non-European format: \"month day year\"." 631American format: \"month day year\"."
632 (if datetime 632 (if datetime
633 (format "%d%s%d%s%d" (nth 4 datetime) ;month 633 (format "%d%s%d%s%d" (nth 4 datetime) ;month
634 (or separator " ") 634 (or separator " ")
@@ -638,6 +638,9 @@ Non-European format: \"month day year\"."
638 ;; datetime == nil 638 ;; datetime == nil
639 nil)) 639 nil))
640 640
641(define-obsolete-function-alias 'icalendar--datetime-to-noneuropean-date
642 'icalendar--datetime-to-american-date "icalendar 0.19")
643
641(defun icalendar--datetime-to-european-date (datetime &optional separator) 644(defun icalendar--datetime-to-european-date (datetime &optional separator)
642 "Convert the decoded DATETIME to European format. 645 "Convert the decoded DATETIME to European format.
643Optional argument SEPARATOR gives the separator between month, 646Optional argument SEPARATOR gives the separator between month,
@@ -653,15 +656,33 @@ FIXME"
653 ;; datetime == nil 656 ;; datetime == nil
654 nil)) 657 nil))
655 658
659(defun icalendar--datetime-to-iso-date (datetime &optional separator)
660 "Convert the decoded DATETIME to ISO format.
661Optional argument SEPARATOR gives the separator between month,
662day, and year. If nil a blank character is used as separator.
663ISO format: (year month day)."
664 (if datetime
665 (format "%d%s%d%s%d" (nth 5 datetime) ;year
666 (or separator " ")
667 (nth 4 datetime) ;month
668 (or separator " ")
669 (nth 3 datetime)) ;day
670 ;; datetime == nil
671 nil))
672
656(defun icalendar--datetime-to-diary-date (datetime &optional separator) 673(defun icalendar--datetime-to-diary-date (datetime &optional separator)
657 "Convert the decoded DATETIME to diary format. 674 "Convert the decoded DATETIME to diary format.
658Optional argument SEPARATOR gives the separator between month, 675Optional argument SEPARATOR gives the separator between month,
659day, and year. If nil a blank character is used as separator. 676day, and year. If nil a blank character is used as separator.
660Call icalendar--datetime-to-(non)-european-date according to 677Call icalendar--datetime-to-*-date according to the
661value of `european-calendar-style'." 678value of `calendar-date-style' (or the older `european-calendar-style')."
662 (if european-calendar-style 679 (funcall (intern-soft (format "icalendar--datetime-to-%s-date"
663 (icalendar--datetime-to-european-date datetime separator) 680 (if (boundp 'calendar-date-style)
664 (icalendar--datetime-to-noneuropean-date datetime separator))) 681 calendar-date-style
682 (if (with-no-warnings european-calendar-style)
683 'european
684 'american))))
685 datetime separator))
665 686
666(defun icalendar--datetime-to-colontime (datetime) 687(defun icalendar--datetime-to-colontime (datetime)
667 "Extract the time part of a decoded DATETIME into 24-hour format. 688 "Extract the time part of a decoded DATETIME into 24-hour format.