All Components


A function that returns the number of the week within a year, which is calculated in relation to the date.

For more information, refer to the ISO week date article.

weekInYear(new Date(2016, 0, 1)); // Week 53, 2015
weekInYear(new Date(2016, 0, 5)); // Week 1, 2016
weekInYear(new Date(2017, 0, 1)); // Week 52, 2016
weekInYear(new Date(2017, 0, 2)); // Week 1, 2017


date Date

The date used for the week number calculation.

weekStartDay Day

The first day of the week. By default, the first week day is Monday.


number - The number of the week within the year.

In this article