diff --git a/src/computersandblues/lodestone/match.cljs b/src/computersandblues/lodestone/match.cljs index 799e863..8a97f32 100644 --- a/src/computersandblues/lodestone/match.cljs +++ b/src/computersandblues/lodestone/match.cljs @@ -45,6 +45,12 @@ (defn date-after-matcher [term] (filter #(> (j/get % :created_at) term))) +(defn date-on-matcher [term] + (let [date-parts (str/split term #"-") + x (parse-long (last date-parts))] + (comp (date-after-matcher term) + (date-before-matcher (str/join "-" (conj (vec (butlast date-parts)) (inc x))))))) + (defn token->term [token] (str/replace token #"^\w+:" "")) @@ -58,6 +64,7 @@ (str/starts-with? token "to:") (mention-matcher (token->term token)) (str/starts-with? token "before:") (date-before-matcher (token->term token)) (str/starts-with? token "after:") (date-after-matcher (token->term token)) + (str/starts-with? token "date:")(date-on-matcher (token->term token)) :else (text-matcher token)))) (reduce comp)) (filter (constantly true))))