Help with using week number from title as reference date

I’m trying to have a week notes template, based on Templater, that allows me to generate the weeknotes in advance.

For this, I need to use the week number of the week notes title as a reference, rather than the current date.

I almost got it, but something’s not quite working as expected.

My weeknotes format is like so: 2022-W38

So I parse the reference date from the title like so:

<% tp.file.title.slice(0,4) %> <% tp.file.title.slice(6,8) %>

which I confirm outputs the expected:

2022 38

I also confirmed that, if I hard code that value into my desired format of the template, like so:

<% tp.date.weekday("DD.MM ddd", 0, "2022 38", "YYYY ww") %>

I also get what I expected:

19.09 Mon

However, when I try and combine the two and make the command truly dynamic:

<% tp.date.weekday("DD.MM ddd", 0, "<% tp.file.title.slice(0,4) %> <% tp.file.title.slice(6,8) %>", "YYYY ww") %>

I get something weird out of it:

07.02 Mon

What am I missing here? Thanks!