supports date filter.

This commit is contained in:
Bryce Covert
2019-05-03 13:51:47 -07:00
parent 34751fe77a
commit 36f5321454
2 changed files with 66 additions and 34 deletions

View File

@@ -10,7 +10,8 @@
[auto-ap.subs :as subs]
[cljs-time.format :as format]
[goog.i18n.NumberFormat.Format]
[cljs-time.core :as t])
[cljs-time.core :as t]
[clojure.string :as str])
(:import
(goog.i18n NumberFormat)
(goog.i18n.NumberFormat Format)))
@@ -76,7 +77,10 @@
(defn dispatch-date-change [event]
(fn [e g]
(re-frame/dispatch (conj event (date->str (time/from-default-time-zone (c/from-date e)) standard)))))
(re-frame/dispatch (conj event
(if (str/blank? e)
e
(date->str (time/from-default-time-zone (c/from-date e)) standard))))))
(defmulti do-bind (fn [a {:keys [type] :as x}]
type))
@@ -163,7 +167,9 @@
event (if (keyword? event) [event] event)
selected (get-in subscription field)
x (str->date selected standard)
selected (if (string? selected) (c/to-date (time/to-default-time-zone (time/from-default-time-zone x))) selected )
selected (if (string? selected)
(c/to-date (time/to-default-time-zone (time/from-default-time-zone x)))
selected )
keys (assoc keys
:on-change (dispatch-date-change (conj event field))
:selected selected