Skip to content

Interpret a link to a daily note (in format YYYY-MM-DD) with a given time as a date

Contributed by via Discord

Use daily file names as real dates

Basic

due:: 2022-01-26

LIST due.day
WHERE due

Variants

Take a time into account

dueWithTime:: 2022-01-28 10:50

LIST dueDate
WHERE dueWithTime
FLATTEN date(regexreplace(dueWithTime, "\[\[(.+?)\]\] (.+)", "$1T$2")) AS dueDate

Ignore trailing text

dueWithTrailingText:: 2022-01-30 need to hand in assignment

LIST dueDate
WHERE dueWithTrailingText
FLATTEN date(regexreplace(dueWithTrailingText, "\[\[(.+?)\]\].+", "$1")) AS dueDate

Ignore trailing text but keep time information

dueWithTimeAndTrailingText:: 2022-01-30 09:00 need to hand in assignment

LIST dueDate
WHERE dueWithTimeAndTrailingText
FLATTEN date(regexreplace(dueWithTimeAndTrailingText, "\[\[(.+?)\]\] ?([0-9:]+).+", "$1T$2")) AS dueDate

Split date/time and trailing text into two separate informations

TABLE dueDate, subject
WHERE dueWithTimeAndTrailingText
FLATTEN date(regexreplace(dueWithTimeAndTrailingText, "\[\[(.+?)\]\] ?([0-9:]+).+", "$1T$2")) AS dueDate
FLATTEN regexreplace(dueWithTimeAndTrailingText, "\[\[(.+?)\]\] ?([0-9:]+)? (.+)", "$3") AS subject