// Makes sure that date is between min and max dates, returns a cloned min or max
export function moveToWithinRange(date: Date, min: Date | null, max: Date | null) {
  if (min && date < min) {
    return new Date(min);
  }
  if (max && date > max) {
    return new Date(max);
  }
  return date;
}
