let time = moment();
console.log(
time
.year(2021)
.week(34)
.day('monday')
.format('D MMM YYYY'),
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Displays 16 Aug 2021 but it should be 23 Aug 2021 - why?
Works well if the year is 2020, 2019, etc but fails on year 2021
Switch .week to .isoWeek and it works.
const moment = require("moment");
let time = moment();
console.log(
time
.year(2021)
.isoWeek(34)
.day('monday')
.format('D MMM YYYY'),
);
More info from this answer https://stackoverflow.com/a/68842658/6254964
It is not wrong. If you look at the 2021 calendar, the 34th week is 15 - 21 August. You specified it as Monday.So it's 16 Aug 2021.
Note: Start of a week is Sunday (ISO Standard).