[Logseq DB v2.0.1] Help needed: Advanced Query to show all blocks & pages created on a specific Journal day

Hi everyone! :waving_hand:

I’m currently using Logseq DB v2.0.1 and I’m looking for help writing a reliable Advanced Query (Datalog) that I can add to my daily Journal page template.

:light_bulb: The Goal & Use Case

I want this query to display a daily “timeline” of all pages and blocks created on that specific calendar day, excluding:

  1. The journal page itself.

  2. Blocks located directly on that journal page.

  3. Query blocks themselves.

Why I need this:

I don’t write everything directly inside my daily Journal. Quite often, I hit Cmd + K, create a new standalone page, drop some quick notes there, and close it. Later, when reviewing my journals, I miss having a consolidated timeline of everything created on that particular date.

:magnifying_glass_tilted_left: Technical Requirements

  • Dynamic target: The query should automatically target the date of the journal page it resides on (e.g., using :query-page or :block/journal-day).

  • Target timezone: Kyiv Time (EEST, UTC+3).

  • Format-independent: Should rely on :block/journal-day (YYYYMMDD) rather than page title strings or :block/created-at of the journal page itself (since the journal file/entity creation timestamp might sometimes fall on the previous day).

  • Entities to fetch: Any new page or block physically created (:block/created-at) within 00:00:0023:59:59 of that journal’s calendar date.

:warning: Challenges Faced So Far

We ran into issues where:

  1. Pages created via Cmd + K lack the :block/page attribute (since they are root entities), causing standard (not [?b :block/page ?j]) logic or or-join conditions to filter them out unintentionally.

  2. Native js/Date.parse or Clojure java.time methods failed or returned empty results inside DataScript queries in Logseq DB environment.

If anyone has a working Datalog query or a clean snippet for Logseq DB v2.0.1 that accurately maps UTC timestamps to local journal days, I’d really appreciate your help!

Thanks in advance! :folded_hands:

I would strongly suggest to create the new pages inside the journal page through references

  • i.e. [[standalone page name]]
  • You can still drop the quick notes inside the new pages:
    • without burdening the journal with the notes themselves
    • without even leaving the journal
      • Just hover on the reference.
  • This is exactly how the journal is supposed to be used:
    • allowing you to provide full context
      • This can actually bring back your memory during reviewing.
    • instead of a (more or less) arbitrary timeline
      • Still easy to produce one if the references are in place.
1 Like

Thanks for the advice, @mentaloid! That actually makes a lot of sense and aligns well with the intended Logseq workflow. I’ll definitely give this approach a try.