Where will you be using this query? In each of the daily notes, or just the weekly review or something similar?
Multiple options are available related to how not to hardcode the dates within the query.
Use a frontmatter field
You could declare the wanted dates within the frontmatter:
---
weekStart: 2023-04-10
weekEnd: 2023-04-16
---
```dataview
TABLE without ID file.link AS Date, file.lists.text AS Highlights
from "Journal/Daily"
WHERE file.day >= date(this.weekStart)
AND file.day <= date(this.weekEnd)
```
Date manipulation
If you’re using Templater you can rather easily find the start and/or end of week when you create your daily/weekly notes.
The same can be done within the Dataview query, where one way of doing it would be to use duration calculation related to your current date. The following example should show the way of doing this:
```dataview
TABLE WITHOUT ID D, D.weekday,
(D - dur(D.weekday + " day")),
(D - dur((D.weekday - 6) + " day"))
FLATTEN list(
"2023-04-01",
"2023-04-02",
"2023-04-03",
"2023-04-04",
"2023-04-15",
"2023-04-16",
"2023-04-17",
"2023-04-18" ) as testDate
FLATTEN date(testDate) as D
WHERE file.path = this.file.path
```
Which produce this output:
In the output you’ll see that it can correctly subtract days across month, and get you the correct week start and ends
So if you do (file.day - dur(file.day.weekday + " day"))
given that you’re either using filenames or fields defining the date, you should get the start of that week. For the end of the week (since we’re basically subtracting to start with): (file.day - dur((file.day.weekday - 6) + " day"))
.
Note that using date(sow)
& co, will always refer to the current date (if I’m not mistaken). So whilst they are valid in the current weekly note, if you open that note in a few weeks, or you go back to a weekly note in the past, it’ll still use current date to calculate start and end of week. In many cases that is not what you intend for them to do.