obsidian-dataview
obsidian-dataview copied to clipboard
file.day does not work
What happened?
I try to use the query below to get all the notes which are related to today. The query returns nothing, unless I replace .day by .cday.
Then, it lists filenames like
20220509 topic 1 20220509 topic 2
According to the documentation, those titles should be enough to populate the implicit field file.day.
Additionally, these files also all have the following in the frontmatter:
date: 2022-05-09T11:15
but still, that's not enough for file.day to be set.
The cday is only an imperfect workaround, as sometimes I create files related to earlier dates.
DQL
list
from "journal work" or "zettelkasten work" or "journal home/diary"
where file.day = date(today)
sort file.name desc
JS
No response
Dataview Version
0.4.26
Obsidian Version
0.14.9
OS
Windows
How do you define "related to the current day"? Some examples would help. If the date field needs to be used, that's what we need to query IIRC. file.day is populated from file title IIRC.
Setting the date field should work; this may be a beta feature not available on 0.4.26, however.
In file titles, dataview should understand both YYYY-MM-DD as well as YYYYMMDD; however, the second syntax may also be a beta feature!
I'd recommend trying the beta or alternatively trying YYYY-MM-DD just to see if it works. I'll be marking the beta as stable soon otherwise.
since we can set the date format in the dataview settings, can the title be recognized using the format we specify? rn I'm using 2022.08.27 and of course it's not picking it up, forcing me to add an unnecessary datapoint using the inline dataview
The date format is only for rendering and not for parsing.
Hey @blacksmithgu Does dataview understand format DD-MM-YYYY ? I try to query and see all the notes created in the same date of the note title. cant resolve it
Like I said above, it does not. You can, however, parse it yourself like so: date(join(reverse(split(file.name, "-")), "-")) and then manipulate it but it would be cleaner to be able to use Luxon directly like in #216. Closing in favor of tracking there.