"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const normalizeDates = require("./_lib-normalizeDates.cjs");
const compareAsc = require("./compareAsc.cjs");
const differenceInCalendarYears = require("./differenceInCalendarYears.cjs");
function differenceInYears(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates.normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  const sign = compareAsc.compareAsc(laterDate_, earlierDate_);
  const diff = Math.abs(differenceInCalendarYears.differenceInCalendarYears(laterDate_, earlierDate_));
  laterDate_.setFullYear(1584);
  earlierDate_.setFullYear(1584);
  const partial = compareAsc.compareAsc(laterDate_, earlierDate_) === -sign;
  const result = sign * (diff - +partial);
  return result === 0 ? 0 : result;
}
exports.default = differenceInYears;
exports.differenceInYears = differenceInYears;
//# sourceMappingURL=differenceInYears.cjs.map
