JSFiddle - React, Tailwind, and code Playground

HTML

<div id="showMondays"></div>

JavaScript

// This Code Counts how many mondays from a specified date to the actual date.
// Create a new date variable
var d = new Date();
var month = d.getMonth() + 1;
var day = d.getDate();

// Get the actual date and store on a variable
var actualDate = d.getFullYear() + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;

// Set dates start and get actual date
var date1 = new Date('10/01/2012'); // Set the begninning date here
var date2 = new Date(actualDate);

var monday = Math.abs(date1.getTime() - date2.getTime()) / (1000 * 60 * 60 * 24 * 7);
monday -= 0.1;
monday = Math.floor(monday);
monday *= 1;

if (date1.getDay() == 1) monday += 1;
if (date2.getDay() == 1) monday += 1;

//$('').html(monday);
$("#showMondays").text(monday);