Add date: matcher
This commit is contained in:
parent
3f11c40acb
commit
d830e52b52
1 changed files with 7 additions and 0 deletions
|
|
@ -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))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue