export function getTheClickedDate(previousDates, newDates) {
  if (previousDates.length < newDates.length) {
    // means the user clicked a date that was not selected before
    // find the date that is not already in existing dates
    return newDates.find(d => !previousDates.find(ca => ca.toISOString() === d.toISOString()));
  }
  // means the user clicked a date that was highlighted
  // find the date that's in existing dates but not in the new dates
  return previousDates.find(ca => !newDates.find(d => ca.toISOString() === d.toISOString()));
}
