const dayjs = require("dayjs");
var isoWeek = require('dayjs/plugin/isoWeek')
dayjs.extend(isoWeek);
year = 2021;
week = 51;
date = dayjs();
date2021 = dayjs().year(year);
date2021week51 = dayjs().year(year).isoWeek(week);
console.log(date); // correct
console.log(date2021); // correct
console.log(date2021week51); // incorrect - should be week 51 of year 2021, not 2020