UNPKG

@chce/weeknumber-iso8601

Version:

Function to calculate the week number of a given date

2 lines (1 loc) 195 B
"use strict";exports.getWeekNumberISO8601=function e(t){var r=864e5,a=t.getFullYear(),n=new Date(a,0),u=(n.getDay()+6)%7,o=+t-(+n-u*r);return(u<4?1:0)+Math.floor(o/r/7)||e(new Date(a-1,11,31))};