    [tick.core :as t]
    )
   (:import
-   [java.time Instant LocalDate LocalDateTime ZonedDateTime ZoneId]))
+   [java.time Instant LocalDate LocalDateTime ZonedDateTime ZoneId]
+   [java.time.format DateTimeFormatter]))
 
 ;; Have considered wrapping ical4j. However, since ical4j does not
 ;; use Java 8 time (as of the time of writing), any appeals to


(defmethod add-contentline-to-model "END"
  [acc contentline]
  ;; END means place the current object in the stack, and start a
  ;; new one
  (let [curr-object (:curr-object acc)
        restore-object (last (:stack acc)) ; check if nil, bad state
        restore-object (update restore-object :subobjects (fnil conj []) curr-object)]
    (-> acc
        (assoc :curr-object restore-object
               :stack (vec (butlast (:stack acc)))))))

(defn property [acc contentline]
  (update-in acc [:curr-object :properties] (fnil conj []) contentline))

(doseq [s ["VERSION" "PRODID" "CALSCALE" "METHOD" "CLASS" "CREATED" "DESCRIPTION"
           "URL" "DTSTART" "DTEND" "DTSTAMP" "LOCATION"
           "PRIORITY" "SEQUENCE" "SUMMARY" "TRANSP"
           "X-WR-CALNAME" "X-WR-CALDESC" "X-MS-OLK-FORCEINSPECTOROPEN"
           "X-MICROSOFT-CDO-BUSYSTATUS"
           "X-MICROSOFT-CDO-IMPORTANCE"
           "X-MICROSOFT-DISALLOW-COUNTER"
           "X-MS-OLK-ALLOWEXTERNCHECK"
           "X-MS-OLK-AUTOFILLLOCATION"
           "X-MICROSOFT-CDO-ALLDAYEVENT"
           "X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT"
           "X-MS-OLK-CONFTYPE"
           "UID"]]
  (defmethod add-contentline-to-model s [acc contentline] (property acc contentline)))

(defmethod add-contentline-to-model :default
  [acc contentline]
  (throw (ex-info (str "Unhandled case " (:name contentline)) {:acc acc :contentline contentline})))

          (fnil conj [])
          {:error message
           :lineno (:lineno contentline)}))

(defrecord VCalendar [])
(defn make-vcalendar [m] (map->VCalendar m))

(defrecord VEvent [])
(defn make-vevent [m] (map->VEvent m))

(defn- instantiate [m]
  (case (:object m)
    "VCALENDAR" (make-vcalendar m)
    "VEVENT" (make-vevent m)
    m))

(defmethod add-contentline-to-model "BEGIN"
  [acc contentline]
