Dataview Query to get notes Created this week (Starting Sunday not Monday)

Challenge

While Obsidian, Templater and many other plugins supports local datetime (For weeks: ‘ww’ instead of ‘WW’) - I couldn’t find a clean way to add a query to a Weekly note: showing all notes created this week.

Solution Approach

While definitely not perfect, but it avoids a need to use dataviewJS or tag all previous notes with week number. This is what i went with and it seems working:

TABLE 
	file.ctime AS "Created",
	dateformat(file.cday, "EEE") as "Day",
	regexreplace(file.folder, ".*/", "") AS "In"
FROM ""
WHERE 
	date(file.cday).year = <% tp.date.now("YYYY")%> AND (
	 (date(file.cday).weekyear = <% tp.date.now("ww")%> AND
	  dateformat(file.cday, "EEE") != "Sun")
	 OR 
	 (date(file.cday).weekyear = <% tp.date.now("ww")%> - 1 AND
	  dateformat(file.cday, "EEE") = "Sun")
	)
SORT file.ctime ASC

Closing Remarks

  • Is there an easier way to do it? Not sure, but if someone have any ideas please do share them.
  • Couldn’t find any source regarding if Dataview planning to either support other datetimes or support latest version of Luxon Tokens - it has a “Local week year, unpadded” with ii but it doesn’t work.

Some relevant posts

Hi,

If you name your weekly notes using the format 2025-W28, this template allows you to automatically display all notes created during that week — without the need for tags or complex dataviewJS scripting.

Just include the following Dataview query inside your weekly note:

TABLE 
	dateformat(file.ctime, "EEEE, dd MMMM") AS "🕒 Created",
	regexreplace(file.folder, ".*/", "") AS "📁 Folder"
FROM ""
WHERE 
	!contains(file.folder, "Templates")
	AND !contains(file.folder, "Attachments")
	AND !contains(file.folder, ".trash")
	AND date(file.cday).year = <% tp.date.now("YYYY") %>
	AND (
		(date(file.cday).weekyear = <% Number.parseInt(tp.file.title.split("-W")[1] ?? "0") %> AND dateformat(file.cday, "EEE") != "Sun")
		OR
		(date(file.cday).weekyear = <% Number.parseInt(tp.file.title.split("-W")[1] ?? "0") %> - 1 AND dateformat(file.cday, "EEE") = "Sun")
	)
SORT file.ctime ASC

The result is a clean and readable weekly summary. You can open any past or future note (e.g., 2025-W10, 2025-W32), and the table will dynamically update to show notes for the corresponding week.

I also adjusted the formatting to make the creation date more human-readable using:

dateformat(file.ctime, "EEEE, dd MMMM")

I hope it helps :slight_smile: