给定日期的一年中的周数

week number of the year by a given date

我得到的日期如下

const today = new Date();

现在我需要获取一年中的周数。我如何在打字稿上得到它?

我试过 const todayFormated = this.datepipe.transform(today, 'W'); 但它返回的是月份的周数而不是年份

小写 'w': const todayFormated = this.datepipe.transform(today, 'w');.

来自Angular Documentation

Week of year w Numeric: minimum digits 1... 53

Week of month W Numeric: 1 digit 1... 5