More consistency with date handling

I’d love it if the various representations of dates in Logseq were more consistent with one another. For example, it would be great if links to journal pages were encoded in the same way that the DEADLINE and SCHEDULED properties are.

Right now, setting a deadline or scheduled attribute on a block lets you create queries for the date, but does not link the block to the journal page corresponding to the date.

In addition, if I link to a journal page in a block (or in its metadata), it just encodes the db id of the referenced page, but doesn’t indicate that the referenced page corresponds to a date. This makes it difficult to query blocks/pages that link to dates (e.g. for getting an overview of blocks linked to past/future dates.

This would also open up the possibility of (eventually) creating pages corresponding to date ranges (e.g. “2021 Week 51” that could automatically link to the journal pages within that week). This would be a killer feature for project management.

I agree. If you set :journal/page-title-format "yyyy-MM-dd EEE" a SCHEDULED date will appear in unlinked references on the daily notes page for the scheduled date but I expect it to be linked (as if I selected the date in the date picker).

I also don’t like “yyyy-MM-dd EEE” as a date format anyway - can this be changed for /Scheduled ?

There is a compatible date format accessible from the Journal pages, it’s just very well hidden! The page property :block/journal-day gives the same format used by scheduled properties and date ranges (YYYYmmDD as an integer I think).
The following query will give all blocks referencing a date in the past week:

#+BEGIN_QUERY
{:title "refs to past 7 days"
  :query [:find (pull ?block [*])
          :in $ ?x ?y
          :where
          [?block :block/refs ?p]
          [?p :block/journal-day ?a]
          [(>= ?a ?x)]
          [(<= ?a ?y)]
]
  :inputs [:7d-before :today]
  :collapsed? false}
#+END_QUERY
1 Like