hunk.code_window:         { start: new Date(2016, 10, 5), end: new Date(NaN) },
         );
         assert(numOverlappingDays === 0);
       });
     });
   });
hunk.labels: keep keep keep keep add keep
hunk.after_edit:   it("properly sorts the dates", () => {
       const result = getOverlappingDaysInIntervals(
         {
           start: new Date(2001, 8 /* Sep */, 1),
           end: new Date(2023, 11 /* Dec */, 20),
         },
         {
           start: new Date(2023, 11 /* Dec */, 21),
           end: new Date(2001, 8 /* Sep */, 9),
         },
       );
       expect(result).toBe(8137);
     });
  
hunk.file_path: src/getOverlappingDaysInIntervals/test.ts
hunk.type: add
file: import { constructFrom } from "../constructFrom/index.js";
  import { setMonth } from "../setMonth/index.js";
  import { toDate } from "../toDate/index.js";
  import type { DateValues } from "../types.js";
  
  /**
   * @name set
   * @category Common Helpers
   * @summary Set date values to a given date.
   *
   * @description
   * Set date values to a given date.
   *
   * Sets time values to date from object `values`.
   * A value is not set if it is undefined or null or doesn't exist in `values`.
   *
   * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
   * to use native `Date#setX` methods. If you use this function, you may not want to include the
   * other `setX` functions that date-fns provides if you are concerned about the bundle size.
   *
   * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
   *
   * @param date - The date to be changed
   * @param values - The date values to be set
   *
   * @returns The new date with options set
   *
   * @example
   * // Transform 1 September 2014 into 20 October 2015 in a single line:
   * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
   * //=> Tue Oct 20 2015 00:00:00
   *
   * @example
   * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
   * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
   * //=> Mon Sep 01 2014 12:23:45
   */
  
  export function set<DateType extends Date>(
    date: DateType | number | string,
    values: DateValues,
  ): DateType {
    let _date = toDate(date);
  
    // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
    if (isNaN(+_date)) {
      return constructFrom(date, NaN);
    }
  
    if (values.year != null) {
      _date.setFullYear(values.year);
    }
  
    if (values.month != null) {
      _date = setMonth(_date, values.month);
    }
  
    if (values.date != null) {
      _date.setDate(values.date);
    }
  
    if (values.hours != null) {
      _date.setHours(values.hours);
    }
  
    if (values.minutes != null) {
      _date.setMinutes(values.minutes);
    }
  
    if (values.seconds != null) {
      _date.setSeconds(values.seconds);
    }
  
    if (values.milliseconds != null) {
      _date.setMilliseconds(values.milliseconds);
    }
  
    return _date;
  }
  