fixed dates.

This commit is contained in:
BC
2018-06-16 18:57:33 -07:00
parent f9c0e55b01
commit b0f401e87b
13 changed files with 49 additions and 68 deletions

View File

@@ -1,6 +1,8 @@
(ns auto-ap.views.utils
(:require [re-frame.core :as re-frame]
[clojure.spec.alpha :as s]
[cljs-time.coerce :as c]
[cljs-time.core :as time]
[auto-ap.events :as events]
[auto-ap.subs :as subs]
[cljs-time.format :as format]))
@@ -27,15 +29,22 @@
(def pretty-long (format/formatter "MM/dd/yyyy HH:mm:ss"))
(def pretty (format/formatter "MM/dd/yyyy"))
(def standard (format/formatter "yyyy-MM-MM"))
(defn date->str [d]
(when d
(format/unparse pretty d)))
(defn date->str
([d] (date->str d pretty))
([d format]
(when d
(format/unparse format d))))
(defn date-time->str [d]
(when d
(format/unparse pretty-long d)))
(defn str->date [d f]
(when d
(format/parse f d)))
(defmulti do-bind (fn [a {:keys [type] :as x}]
type))