code: function addDayToRange(day) {
    var range = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { from: null, to: null };
    var from = range.from,
        to = range.to;
  
    if (!from) {
      from = day;
    } else if (from && to && isSameDay(from, to) && isSameDay(day, from)) {
      from = null;
      to = null;
    } else if (to && isDayBefore(day, from)) {
      from = day;
    } else if (to && isSameDay(day, to)) {
      from = day;
      to = day;
    } else {
      to = day;
      if (isDayBefore(to, from)) {
        to = from;
        from = day;
      }
    }
  
    return { from: from, to: to };
  }
docs: Add a day to a range and return a new range. A range is an object with
  `from` and `to` days.
  
  @export
  @param {Date} day
  @param {Object} range
  @return {Object} Returns a new range object