Advance Query - Sort by latest update datetime

Hi, stumbled across this when I was looking into my own ‘tasks completed today’ query. the :block/updated-at property is only populated on the blocks if you enable the option in config.edn, like so:

  :feature/enable-block-timestamps? true

Then you can query like:

{:title "✅  Done Today"
    :query [:find (pull ?h [*])
            :in $ ?today ?tomorrow
            :where
            [?h :block/marker "DONE"]
            [?h :block/updated-at ?d]
            [(> ?d ?today)]
            [(< ?d ?tomorrow)]]
    :inputs [:today :+1d]
    :collapsed? false}
2 Likes