I am getting some weird output for certain dates for moment js.
It is only for the dates 1st, 2nd and 3rd of Jan 2022 otherwise it works as expected.
I would expect the same output regardless of the current date.
Any idea why this is occurring?
console.log('Test 2019', moment().year(2019).week(48).endOf("week"));
console.log('Test 2020', moment().year(2020).week(48).endOf("week"));
console.log('Test 2021', moment().year(2021).week(48).endOf("week"));
console.log('Test 2022', moment().year(2022).week(48).endOf("week"));
console.log('Test 2023', moment().year(2023).week(48).endOf("week"));
// With date of device set to the future 3/Jan/2022
Test 2019 Sun Dec 09 2018 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2020 Sun Dec 08 2019 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2021 Sun Dec 06 2020 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2022 Sun Dec 04 2022 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2023 Sun Dec 03 2023 23:59:59 GMT+1300 (New Zealand Daylight Time)
// With date of device set to the today 15/dec/2021
Test 2019 Sun Dec 08 2019 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2020 Sun Dec 06 2020 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2021 Sun Dec 05 2021 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2022 Sun Dec 04 2022 23:59:59 GMT+1300 (New Zealand Daylight Time)
Test 2023 Sun Dec 03 2023 23:59:59 GMT+1300 (New Zealand Daylight Time)