Function: icalendar-fix-hyphenated-dates

icalendar-fix-hyphenated-dates is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-fix-hyphenated-dates)

Documentation

Correct dates in "YYYY-MM-DD..." format to "YYYYMMDD..." format.

This function is intended to be used from icalendar-pre-parsing-hook, which see.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:fix-hyphenated-dates ()
  "Correct dates in \"YYYY-MM-DD...\" format to \"YYYYMMDD...\" format.
This function is intended to be used from `icalendar-pre-parsing-hook',
which see."
  (goto-char (point-min))
  (while (re-search-forward
          (rx line-start
              (or "COMPLETED" "DTEND" "DUE" "DTSTART" "RECURRENCE-ID"
                  "EXDATE" "RDATE" "CREATED" "DTSTAMP" "LAST-MODIFIED")
              (zero-or-more ical:other-param-safe)
              ":")
          nil t)
    (unless (looking-at-p (rx (or ical:date ical:date-time)))
      (while (re-search-forward ; exdate, rdate allow lists
              (rx (group-n 1 (= 4 digit))
                  "-"
                  (group-n 2 (= 2 digit))
                  "-"
                  (group-n 3 (= 2 digit)))
              (line-end-position) t)
      (replace-match "\\1\\2\\3" nil nil)))))