Browse Source

fix: query for :datetime value through query builder

Gabriel Horner 9 months ago
parent
commit
9c0bfda2c6
2 changed files with 10 additions and 6 deletions
  1. 7 4
      deps/db/src/logseq/db/common/view.cljs
  2. 3 2
      src/main/frontend/db/async.cljs

+ 7 - 4
deps/db/src/logseq/db/common/view.cljs

@@ -473,10 +473,13 @@
                       distinct
                       (map (fn [v]
                              (let [e (when ref-type? (d/entity db v))
-                                   [label value] (if ref-type?
-                                                   [(db-property/property-value-content e)
-                                                    (select-keys e [:db/id :block/uuid])]
-                                                   [(str v) v])]
+                                   [label value] (cond ref-type?
+                                                       [(db-property/property-value-content e)
+                                                        (select-keys e [:db/id :block/uuid])]
+                                                       (= :datetime (:logseq.property/type property))
+                                                       [v v]
+                                                       :else
+                                                       [(str v) v])]
                                {:label label
                                 :value value})))
                       (common-util/distinct-by :label)))]

+ 3 - 2
src/main/frontend/db/async.cljs

@@ -90,8 +90,9 @@
     (file-async/<get-file-based-property-values graph property)))
 
 (defn <get-property-values
-  "For db graphs, returns property value ids for given property db-ident.
-   Separate from file version because values are lazy loaded"
+  "For db graphs, returns a vec of property value maps for given property
+  db-ident.  The map contains a :label key which can be a string or number (for
+  query builder) and a :value key which contains the entity or scalar property value"
   [property-id & {:as opts}]
   (when property-id
     (state/<invoke-db-worker :thread-api/get-property-values (state/get-current-repo)