Auto-insert date range for tasks/events based on weekly notes title?

What I’m trying to do

Hello all! I’m trying to set up my weekly notes to autopull any events and tasks for the date range of that week. I would like to be able to generate this early or late and have the relevant date range show, rather than the current week. I figured out how to do this for my daily notes using the below:

> ```tasks
> 	not done
> 	due on <%tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD")%>
> 	short mode
> ```

Here is the weekly coding I’m currently using for tasks:

 ```tasks
not done
due this week
short mode```

and events:

```dataview  
TASK  
WHERE (contains(tags, "calendar")  
OR contains(tags, "holiday")
OR contains(tags, "birthday"))  
AND (scheduled >= date(tomorrow)  
AND scheduled <= date(today) + dur(7 days)) 
SORT scheduled ASC  
GROUP by scheduled  
```

I can’t figure out how to use the same method for weekly notes. A lot of this is new to me so I’m learning and may be missing something obvious. I’ve enabled templater, dataview, and tasks. I appreciate any help!

Things I have tried

I’ve looked through the forums and Google and read through the templater and dataview docs, but I’m still unsure. I’ve also tried using the same bit of code as the daily and changing the format to match the weekly notes titles but no luck.

I actually figured this out myself! Putting the code up in case anyone else finds it useful (this is assuming a gggg-[W]ww date format for weekly notes titles).

Tasks Plugin:

```tasks
not done
due after <% tp.date.now("YYYY-[W]WW", -7, tp.file.title, "YYYY-[W]WW") %>
due before <% tp.date.now("YYYY-[W]WW", 7, tp.file.title, "YYYY-[W]WW") %>
short mode
```

Dataview:

```dataview  
TASK  
WHERE (contains(tags, "holiday"))
AND scheduled.weekyear = <% moment(tp.file.title,'gggg-[W]ww').format("ww") %>
SORT scheduled ASC  
GROUP by scheduled  
```