What I’m trying to do
i’m creating a note template for weekly notes where i want to list the books and articles i read in said week.
Things I have tried
first, i tried to get this information by way of using the creation date of my literature note. this worked just fine:
```dataview
LIST
WHERE econtains(type, "literature")
WHERE date(file.cdate).year = date(this.file.cday).year
WHERE date(file.cdate).weekyear = date(this.file.cday).weekyear
```
but there’s a missmatch of the creation date of the note and the day i read the book/article, therefore i added another parameter to the front matter:
reading-date: 30-08-2022
now, i don’t now how to make the dataview search work with this adaption. that’s why i’m reaching out to the community. may i ask you to be patient as i’m new to obsidian and not familiar with JS.
great, this helps!
i further adapted the code so that the weekyear is not extracted from the creation date, but from the file name because sometimes i create the weekly notes later.
my version is this:
```dataview
LIST
FROM "3_knowledge-base"
WHERE econtains(type, "literature")
WHERE reading-date != null
FLATTEN regexreplace(reading-date, "^(\d{2})-(\d{2})-(\d{4})$", "$3-$2-$1") AS s_rDate
WHERE date(s_rDate) != null
WHERE date(s_rDate).year = this.file.cday.year
WHERE date(s_rDate).weekyear = number(split(this.file.name, "W")[1])
```
this works perfectly!
i also tried to use the same method for extracting the year from the filename, but for some reason this didn’t work. (run by itself it returns “2022” as the above function. any idea why id doesn’t work when implemented in the dataview code?
```dataview
WHERE date(s_rDate).year = number(split(this.file.name, "-",1))
```