![[<%+ tp.date.now(“YYYY-MM-DD”)%>]] ← that thinks you want to transclude the note named literally “<%+ tp.date.now(“YYYY-MM-DD”)%>” even though without the ![[ ]] the correct date displays
I also tried using inline dataviewjs like this: $= dv.current().file.mtime
but I can’t even figure out how to change the date format - it just shows the date like “11:08 pm - October 05, 2022”
What I’m trying to do
I want to set up a workspace where I include a fixed pane that displays the note for todays date
e.g. ![[2022-10-05]]
(which is obviously different every day). So I thought it should be possible to just transclude based on the variable “Date” somehow. I just cant figure out how to get that to work.
But I have the idea that embeds in dataview aren’t yet a very stable / reable things (sometimes works, others not; need to jump to another note and return…). But try.
Dataview (for inline JS query ‘moment(t.text, ‘YYYY-MM-DD’)’): TypeError: Cannot read properties of undefined (reading ‘text’)
Evaluation Error: SyntaxError: Unexpected identifier ‘dv’
at DataviewInlineApi.eval (plugin:dataview:19597:21)
at evalInContext (plugin:dataview:19598:7)
at asyncEvalInContext (plugin:dataview:19608:32)
at DataviewJSRenderer.render (plugin:dataview:19629:19)
at DataviewJSRenderer.onload (plugin:dataview:19213:14)
at e.load (http://localhost/app.js:1:730611)
at e.addChild (http://localhost/app.js:1:731035)
at Object.addChild (http://localhost/app.js:1:1616920)
at DataviewApi.executeJs (plugin:dataview:20138:19)
at DataviewPlugin.dataviewjs (plugin:dataview:20386:18)
To start, what I write isn’t an inline query (it’s a dataviewjs block query).
In js case you can use it as an inline query, but you need to separate things (if no break line you need to use “;”). So
ok, We’re half way there, the thing you posted there does generate the correct “today date” in view mode, but when I surround it by [] brackets, the brackets treat what’s inside them as the text of the code rather than today’s date
why you want to add brackets?
sorry but I don’t understand what you’re trying to do.
the code search for pages with the date in title (in format “YYYY-MM-DD”) and select only the pages (I hope only one) with “today” date. in the code dv.date("today") is in fact the today date… don’t need to change anything!
First point: the proposed query do all that, don’t need to add the code between brackets (and inline code between brackets doesn’t work).
Second point:
As I said, sometimes it works and others not (in this case it renders only the file name and you think that is a today date, but is the file name). Try the query in a new note, without other content (just to reduce the render efforts) and if it renders only the name, change to other note and return… sometimes works. (I don’t know the technical apparatus involved, but seems a very unstable thing)
“Daily Notes” is one of the core plugs.
You turn it on and tell it where to find the template.
The name of the note is the date and then in the template I have:
{{title}} {{date:dddd}}
Because the date is the name/title of the file the {{title}} variable displays the date in YYYY-MM-DD format. The second variable, {{date:dddd}} displays the day of the week.
If you go into “core plug-ins” then “daily notes” and then click on the tiny configuration gear, the last option is:
Open daily note on startup
Open your daily note automatically whenever you open this vault.
Does that option do what you want?
Daily note creates the note for the date using the template you specify and you can choose to have the daily note automatically displayed when you open the vault.