Reputation: 642
As per the documentation, the following code should work:
moment(moment('2020043').format("YYYYwwe")).format("YYYY-MM-DD");
I'm trying to get 3rd day of 4th week of 2020
Upvotes: 0
Views: 59
Reputation: 31482
No, you have to use moment(String, String)
and use YYYYWWE
as parsing tokens (case sensitive), where YYYY
is the 4 digit year WW
is ISO week of year and E
is ISO day of week.
Example:
console.log(moment('2020043', "YYYYWWE").format("YYYY-MM-DD"));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
Upvotes: 1