Get date in dataviewjs from frontmatter

What I’m trying to do

I want to get all tasks from the week of the date written in the frontmatter.

Things I have tried

Here is where I am:
This is working well for today but I don’t manage to include the date put in the frontmatter:

var now = moment(dv.current().date);
var sow = now.startOf('week').subtract(1, 'days').format('YYYY-MM-DD');
var eow = now.endOf('week').add(8, 'days').format('YYYY-MM-DD');
const query = `
done
(done after ${sow}) AND (done before ${eow})
hide task count
`;
dv.paragraph('```tasks\n' + query + '\n```');

Thanks in advance for your help!

This seems to work but is so ugly:

var now = moment(dv.current().date.year+"-"+dv.current().date.month+"-"+dv.current().date.day);
var sow = now.startOf('week').subtract(1, 'days').format('YYYY-M-D');
var eow = now.endOf('week').add(8, 'days').format('YYYY-MM-DD');
const query = `
done
(done after ${sow}) AND (done before ${eow})
hide task count
`;
dv.paragraph('```tasks\n' + query + '\n```');

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.