JSFiddle - React, Tailwind, and code Playground

JavaScript

function dateDiffInWeeks(a,b) {
  var _MS_PER_WEEK = 1000 * 60 * 60 * 24 * 7;
  // Discard the time and zone
  var utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
  var utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
  return Math.floor((utc2 - utc1) / _MS_PER_WEEK);
}

var today = new Date();
var anotherDay = new Date("Fri Nov 20 2009");

alert(dateDiffInWeeks(today,anotherDay));