How do I how a section from a previous date note?

Hello all,

I am trying to tweak my daily notes and I want a section with “Done yesterday”, so far I have this in my template:

# Done yesterday
![[<%*
	let lastDay = tp.date.now("YYYY-MM-DD", -1);
	const today = tp.date.now("ddd");
	 if (today === "Mon") {
	  lastDay = tp.date.now("YYYY-MM-DD", -3);
	 }
	 const lastDayTitle = lastDay + "-Daily Log";
	 const fullFilenameFromLastDay = monthFolder + lastDayTitle;
	 console.log(fullFilenameFromLastDay);
	 //fullFilenameFromLastDay^Summary
%>]]

However, I do not achieve to show the content of the “Summary” section from yesterday.

Also, another issue is that right now “yesterday” is just “yesterday” or if it’s Monday then I grab Friday, but ideally I would like to just grab the latest file created under the folder “Daily Tasks”. Is there a way. to do that also?

Thank you in advance and regards

Given a proper link to a file you can do something like:

<%* 
const yourFilename = "your note name"
tR += "![[" + yourFilename + "#^Summary]]\n"
_%>

Regarding how to find Friday’s note instead of Monday’s note as yesterdays note it’s a lot trickier, but it’s doable if you do a query based on the modification time (or the file.day if your names are properly named), and then choose to use the file in front of your current file.

So give us some example of your file names, and if they don’t contain an ISO date, like YYYY-MM-DD, do they have a property called date with that information?