 (defprotocol ICalendarValue
   (serialize-value [_] ""))
 
-(def DATE-PATTERN (java.time.format.DateTimeFormatter/ofPattern "YYYYMMdd"))
-
-(def DATE-TIME-FORM-1-PATTERN (java.time.format.DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmss"))
+(def DATE-TIME-FORM-1-PATTERN (DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmss"))
 
 ;; Only call with ZoneID of UTC otherwise produces invalid ICAL format
-(def DATE-TIME-FORM-2-PATTERN (java.time.format.DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmssX"))
-
-(def DATE-TIME-FORM-3-PATTERN (java.time.format.DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmss"))
+(def DATE-TIME-FORM-2-PATTERN (DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmssX"))
+
+(def DATE-TIME-FORM-3-PATTERN (DateTimeFormatter/ofPattern "YYYYMMdd'T'HHmmss"))
 
 (extend-protocol ICalendarValue
   String

(defn line->contentline [s]
  (let [m (s/conform ::contentline (seq s))]
    (when-not (:name m) (throw (ex-info "No name" {:contentline s})))
    {:name (-> m :name extract-name-as-string)
     :params (->> m :params
                  (map (juxt
                         (comp extract-name-as-string :param-name :param)
                         (comp extract-param-value-as-string :param-value :param)))
                  (into {} ))
     :value (-> m :value str/join)}))

;; JCF tip
;;(s/conform (s/and (s/conformer seq) ::iana-token) "foobar")

  Instant
  (serialize-value [i] {:value (.format (ZonedDateTime/ofInstant i (ZoneId/of "UTC")) DATE-TIME-FORM-2-PATTERN)})
  LocalDate
  (serialize-value [s] {:value (.format s DateTimeFormatter/BASIC_ISO_DATE)})
  LocalDateTime
  (serialize-value [s] {:value (.format s DATE-TIME-FORM-1-PATTERN)})
  ZonedDateTime
