{"ast":null,"code":"import { compareAsc } from \"./compareAsc.mjs\";\nimport { differenceInCalendarMonths } from \"./differenceInCalendarMonths.mjs\";\nimport { isLastDayOfMonth } from \"./isLastDayOfMonth.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @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).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of full months\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\nexport function differenceInMonths(dateLeft, dateRight) {\n  const _dateLeft = toDate(dateLeft);\n  const _dateRight = toDate(dateRight);\n  const sign = compareAsc(_dateLeft, _dateRight);\n  const difference = Math.abs(differenceInCalendarMonths(_dateLeft, _dateRight));\n  let result;\n\n  // Check for the difference of less than month\n  if (difference < 1) {\n    result = 0;\n  } else {\n    if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) {\n      // This will check if the date is end of Feb and assign a higher end of month date\n      // to compare it with Jan\n      _dateLeft.setDate(30);\n    }\n    _dateLeft.setMonth(_dateLeft.getMonth() - sign * difference);\n\n    // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n    // If so, result must be decreased by 1 in absolute value\n    let isLastMonthNotFull = compareAsc(_dateLeft, _dateRight) === -sign;\n\n    // Check for cases of one full calendar month\n    if (isLastDayOfMonth(toDate(dateLeft)) && difference === 1 && compareAsc(dateLeft, _dateRight) === 1) {\n      isLastMonthNotFull = false;\n    }\n    result = sign * (difference - Number(isLastMonthNotFull));\n  }\n\n  // Prevent negative zero\n  return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInMonths;","map":{"version":3,"names":["compareAsc","differenceInCalendarMonths","isLastDayOfMonth","toDate","differenceInMonths","dateLeft","dateRight","_dateLeft","_dateRight","sign","difference","Math","abs","result","getMonth","getDate","setDate","setMonth","isLastMonthNotFull","Number"],"sources":["/root/rfcontavagas_hom/12.-Servidor-local-Docker/Front-Parking-Angular/node_modules/date-fns/differenceInMonths.mjs"],"sourcesContent":["import { compareAsc } from \"./compareAsc.mjs\";\nimport { differenceInCalendarMonths } from \"./differenceInCalendarMonths.mjs\";\nimport { isLastDayOfMonth } from \"./isLastDayOfMonth.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @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).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of full months\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\nexport function differenceInMonths(dateLeft, dateRight) {\n  const _dateLeft = toDate(dateLeft);\n  const _dateRight = toDate(dateRight);\n\n  const sign = compareAsc(_dateLeft, _dateRight);\n  const difference = Math.abs(\n    differenceInCalendarMonths(_dateLeft, _dateRight),\n  );\n  let result;\n\n  // Check for the difference of less than month\n  if (difference < 1) {\n    result = 0;\n  } else {\n    if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) {\n      // This will check if the date is end of Feb and assign a higher end of month date\n      // to compare it with Jan\n      _dateLeft.setDate(30);\n    }\n\n    _dateLeft.setMonth(_dateLeft.getMonth() - sign * difference);\n\n    // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n    // If so, result must be decreased by 1 in absolute value\n    let isLastMonthNotFull = compareAsc(_dateLeft, _dateRight) === -sign;\n\n    // Check for cases of one full calendar month\n    if (\n      isLastDayOfMonth(toDate(dateLeft)) &&\n      difference === 1 &&\n      compareAsc(dateLeft, _dateRight) === 1\n    ) {\n      isLastMonthNotFull = false;\n    }\n\n    result = sign * (difference - Number(isLastMonthNotFull));\n  }\n\n  // Prevent negative zero\n  return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInMonths;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,0BAA0B,QAAQ,kCAAkC;AAC7E,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,MAAM,QAAQ,cAAc;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,QAAQ,EAAEC,SAAS,EAAE;EACtD,MAAMC,SAAS,GAAGJ,MAAM,CAACE,QAAQ,CAAC;EAClC,MAAMG,UAAU,GAAGL,MAAM,CAACG,SAAS,CAAC;EAEpC,MAAMG,IAAI,GAAGT,UAAU,CAACO,SAAS,EAAEC,UAAU,CAAC;EAC9C,MAAME,UAAU,GAAGC,IAAI,CAACC,GAAG,CACzBX,0BAA0B,CAACM,SAAS,EAAEC,UAAU,CAClD,CAAC;EACD,IAAIK,MAAM;;EAEV;EACA,IAAIH,UAAU,GAAG,CAAC,EAAE;IAClBG,MAAM,GAAG,CAAC;EACZ,CAAC,MAAM;IACL,IAAIN,SAAS,CAACO,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAIP,SAAS,CAACQ,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;MAC1D;MACA;MACAR,SAAS,CAACS,OAAO,CAAC,EAAE,CAAC;IACvB;IAEAT,SAAS,CAACU,QAAQ,CAACV,SAAS,CAACO,QAAQ,CAAC,CAAC,GAAGL,IAAI,GAAGC,UAAU,CAAC;;IAE5D;IACA;IACA,IAAIQ,kBAAkB,GAAGlB,UA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