Query reverse sort unexpected result

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?

: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]

Right now your sort just gets skipped actually.
You are already pulling out a page. A page has no :block/page attribute.
Therefore you sort directly on :block/journal-day
I.e. (get h [:block/journal-day])

Mmmmh, OK, thanks. Gotta go look at more examples to get a better feel for that query language then.

you could try:
:result-transform (fn [result] (reverse(sort-by (fn [r] (get-in r [:block/page :block/journal-day])) result )))