calculateWeeksNumber static method

double calculateWeeksNumber(
  1. DateTime startDate,
  2. DateTime endDate
)

Calculate the max number of weeks in a date interval between monthStartDate and monthEndDate which have the same month.

Implementation

static double calculateWeeksNumber(DateTime startDate, DateTime endDate) {
  var daysBetweenDates = endDate.difference(startDate);

  return daysBetweenDates.inDays / DateTime.daysPerWeek;
}