macro | previously cljs.spec/inst-in | clojure.spec.alpha/inst-in | Edit |
(inst-in start end)
Returns a spec that validates insts in the range from start (inclusive) to end (exclusive).
(defmacro inst-in
[start end]
`(let [st# (cljs.core/inst-ms ~start)
et# (cljs.core/inst-ms ~end)
mkdate# (fn [d#] (js/Date. d#))]
(spec (and cljs.core/inst? #(inst-in-range? ~start ~end %))
:gen (fn []
(gen/fmap mkdate#
(gen/large-integer* {:min st# :max et#}))))))