src/utils.js
function getStartDate(date, minDate, maxDate) {
  let startDate = startOfDay(date);
  if (minDate) {
    const minDateNormalized = startOfDay(minDate);
    if (isBefore(startDate, minDateNormalized)) {
      startDate = minDateNormalized;
    }
  }
  if (maxDate) {
    const maxDateNormalized = startOfDay(maxDate);
    if (isBefore(maxDateNormalized, startDate)) {
      startDate = maxDateNormalized;
    }
  }
  return startDate;
}
function getStartDate(date, minDate, maxDate) {
  let startDate = startOfDay(date);
  if (minDate) {
    const minDateNormalized = startOfDay(minDate);
    if (isBefore(startDate, minDateNormalized)) {
      startDate = minDateNormalized;
    }
  }
  if (maxDate) {
    const maxDateNormalized = startOfDay(maxDate);
    if (isBefore(maxDateNormalized, startDate)) {
      startDate = maxDateNormalized;
    }
  }
  return startDate;
}
function getStartDate ( date , minDate , maxDate ) { let startDate = startOfDay ( date ) ; if ( minDate ) { const minDateNormalized = startOfDay ( minDate ) ; if ( isBefore ( startDate , minDateNormalized ) ) { startDate = minDateNormalized ; } } if ( maxDate ) { const maxDateNormalized = startOfDay ( maxDate ) ; if ( isBefore ( maxDateNormalized , startDate ) ) { startDate = maxDateNormalized ; } } return startDate ; }
Figures out the actual start date based on
the min and max dates available.
@param {Date} date The we want to start the calendar at
@param {Date} minDate The earliest date available to start at
@param {Date} maxDate The latest date available to start at
@returns {Date} The actual start date
Figures out the actual start date based on the min and max dates available .