I have an array of date-ranges from which I need to know how many people have worked in each week for the whole year.
Eg: mainArray = ['01-01-2020','31-12-2020']; //year range
dateRanges = [
  [01-01-2020, 03-01-2020], //week 1
  [03-01-2020, 06-01-2020], //week 1 and 2
  [09-01-2020, 09-01-2020], //week 2
  [10-01-2020, 11-01-2020], //week 2
  [22-01-2020, 23-01-2020], //week 4
  ....
];
//first we need to find all the weeks from the mainArray date-range 
//then calculate the weeks colliding in the dateRanges array.
the output should be =>
workLoadInWeeks = [2,3,0,1,0,0,0,0,......,0];
Explanation: Since 03-01-2020(date in week-1) is repeating in 1st and 2nd array indexes, that's why the output has 2 as the first value.
Since the dates of week-2 are repeating in dateRanges[1], dateRanges[2], dateRanges[3], that's why the output has 3 as the second value.
since nobody worked in 3rd week its 0 in the output array
Week start - Sunday, 
7 days a week,
I want the week date range to start from the 1st Jan, so first week would be a partial week as 1st start is a Wednesday.
This may sound confusing. I have tried my best to explain.