Reputation: 2444
I got the date as follow
const today = new Date();
now I need to get the week number of the year. How do I get it on the typescript?
I tried const todayFormated = this.datepipe.transform(today, 'W');
but it is returning the week number of the month not year
Upvotes: 1
Views: 5793
Reputation: 6183
It is lowercase 'w'
: const todayFormated = this.datepipe.transform(today, 'w');
.
From the Angular Documentation:
Week of year w Numeric: minimum digits 1... 53
Week of month W Numeric: 1 digit 1... 5
Upvotes: 3