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