I am trying to show all notes with a certain tag (meeting) in my weekly review note. The following code does this but it shows meetings from both the current year and previous years. I would like it to show just the current year.
Frontmatter:
---
date: 2023-08-02
date modified: 2023-08-03
tags:
- weekly
---
My friend ChatGPT says:
The issue in the code is that it’s filtering by the current week number, but not taking the year into account. Week numbers restart each year, so without considering the year, you may get results from the same week number but from different years.
Here’s a corrected version of the code that filters by both the current week number and the current year:
```dataviewjs
let currentDate = dv.current().date;
let currentWeekNumber = currentDate?.weekNumber;
let currentYear = currentDate?.year;
dv.list(dv
.pages("#meeting")
.where(n => n.date?.weekNumber == currentWeekNumber && n.date?.year == currentYear)
.sort(n => n.date)
.file.link)