I have tinkered together the following query with the goal of giving me a list of journals from the last 30 days in reverse chronological order. It does seem, however, not to sort by journal date but by last-modified date… What am I missing?
#+BEGIN_QUERY
{
:title [:b "Pages list"]
:query [:find (pull ?p [*])
:in $ ?start ?today
:where [?p :block/journal-day ?d]
[(>= ?d ?start)]
[(<= ?d ?today)]
]
:result-transform (fn [result]
(reverse (sort-by (fn [h] (get h [:block/page :block/journal-day])))))
:inputs [:30d-before :today]
}
#+END_QUERY