Hi everyone! ![]()
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.
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:
-
The journal page itself.
-
Blocks located directly on that journal page.
-
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.
Technical Requirements
-
Dynamic target: The query should automatically target the date of the journal page it resides on (e.g., using
:query-pageor: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-atof 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) within00:00:00–23:59:59of that journal’s calendar date.
Challenges Faced So Far
We ran into issues where:
-
Pages created via
Cmd + Klack the:block/pageattribute (since they are root entities), causing standard(not [?b :block/page ?j])logic oror-joinconditions to filter them out unintentionally. -
Native
js/Date.parseor Clojurejava.timemethods 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! ![]()