List every day of the month in a monthly note using Templater

To create a list linking to every day of the month in a monthly note, use the Templater code below.

<%*
let last_day = moment(tp.file.title, "YYYY-MM").endOf('month');
let day = moment(tp.file.title, "YYYY-MM").startOf('month');
while (!day.isAfter(last_day)) {
    tR += `### [[${day.format("YYYY-MM-DD")}]] (${day.format("dddd")})\n\n`;
    day.add(1, 'd');
}
-%>