const DateUtils = {

  /**
   * Clone a date returning a new date with the same time
   * @param  {Date} d The date to clone
   * @return {Date} The cloned date
   */
  clone(d) {
    return new Date(d.getTime());
  },

  /**
   * Return `true` if two dates are the same day, ignoring the time.
   * @param  {Date}  d1
   * @param  {Date}  d2
   * @return {Boolean}
   */
  isSameDay(d1, d2) {
    return d1.getDate() === d2.getDate() &&
      d1.getMonth() === d2.getMonth() &&
      d1.getFullYear() === d2.getFullYear();
  },

  /**
   * Returns true if a day is in the past, e.g. is yesterday or any day
   * before yesterday.
   *
   * @param  {Date}  d
   * @return {Boolean}
   */
  isPastDay(d) {
    const today = new Date();
    today.setHours(0, 0, 0, 0);
    return d < today;
  },

  /**
   * Returns true if the day `d` is between the days d1 and d2, not including those
   * days.
   *
   * @param  {Date}  d
   * @param  {Date}  d1
   * @param  {Date}  d2
   * @return {Boolean}
   */
  isDayBetween(d, d1, d2) {
    d = DateUtils.clone(d);
    d1 = DateUtils.clone(d1);
    d2 = DateUtils.clone(d2);

    d.setHours(0, 0, 0, 0);
    d1.setHours(0, 0, 0, 0);
    d2.setHours(0, 0, 0, 0);
    return (d1 < d && d < d2) || (d2 < d && d < d1);
  },

  /**
   * Add a day to a range, returning a new range. A range is an object with
   * `from` and `to` keys.
   *
   * @param {Date} day
   * @param {Object} range
   * @return {Object} Returns a new range object
   */
  addDayToRange(day, range={from: null, to: null}) {
    let { from, to } = range;
    if (!from) {
      from = day;
    }
    else if (from && to && DateUtils.isSameDay(from, to) && DateUtils.isSameDay(day, from)) {
      // reset when selecting again the first day
      from = null;
      to = null;
    }
    else if (to && day < from) {
      from = day;
    }
    else if (to && DateUtils.isSameDay(day, to)) {
      from = day;
      to = day;
    }
    else {
      to = day;
      if (to < from) {
        to = from;
        from = day;
      }
    }

    return { from, to };
  },

  /**
   * Returns true if a day is included in a range of days. A range is an
   * object with a `from` and `to` dates.
   *
   * @param  {Date}  day
   * @param  {Object}  range
   * @return {Boolean}
   */
  isDayInRange(day, range) {
    const { from, to } = range;
    return (from && DateUtils.isSameDay(day, from)) ||
      (to && DateUtils.isSameDay(day, to)) ||
      (from && to && DateUtils.isDayBetween(day, from, to));
  }

};

export default DateUtils;

@@ -77,17 +77,24 @@
 ame time
+.%0A   * 
 %0A
-
    * @pa
@@ -290,24 +290,31 @@
 ng the time.
+.%0A   * 
 %0A   * @param
@@ -546,38 +546,39 @@
  /**%0A   * Return
-s
  
+%60
 true
+%60
  if a day is in 
@@ -816,30 +816,31 @@
 %0A   * Return
-s
  
+%60
 true
+%60
  if the day 
@@ -867,21 +867,35 @@
 ays 
+%60
 d1
+%60
  and 
+%60
 d2
+%60
 , 
-no
+%0A   * withou
 t in
@@ -908,21 +908,10 @@
 g th
-ose%0A   * days
+em
 .%0A  
@@ -1382,10 +1382,10 @@
 to%60 
-ke
+da
 ys.%0A
@@ -2108,14 +2108,15 @@
 turn
-s
  
+%60
 true
+%60
  if 
@@ -2156,64 +2156,8 @@
 ays.
- A range is an%0A   * object with a %60from%60 and %60to%60 dates.
 %0A   

Update jsdocs