🌱 JavaScript Get Week Number

Source
Date.prototype.getWeek = function () {
  var dt = new Date(this.getFullYear(), 0, 1)
  return Math.ceil(((this - dt) / 86400000 + dt.getDay() + 1) / 7)
}

var myDate = new Date(2013, 3, 25) // 2013, 25 April

console.log(myDate.getWeek())
Made by Brandon . If you find this project useful you can donate.