{"ast":null,"code":"import { addDays } from \"./addDays.mjs\";\nimport { differenceInCalendarDays } from \"./differenceInCalendarDays.mjs\";\nimport { isSameDay } from \"./isSameDay.mjs\";\nimport { isValid } from \"./isValid.mjs\";\nimport { isWeekend } from \"./isWeekend.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInBusinessDays\n * @category Day Helpers\n * @summary Get the number of business days between the given dates.\n *\n * @description\n * Get the number of business day periods between the given dates.\n * Business days being days that arent in the weekend.\n * Like `differenceInCalendarDays`, the function removes the times from\n * the dates before calculating the difference.\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 business days\n *\n * @example\n * // How many business days are between\n * // 10 January 2014 and 20 July 2014?\n * const result = differenceInBusinessDays(\n *   new Date(2014, 6, 20),\n *   new Date(2014, 0, 10)\n * )\n * //=> 136\n *\n * // How many business days are between\n * // 30 November 2021 and 1 November 2021?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 30),\n *   new Date(2021, 10, 1)\n * )\n * //=> 21\n *\n * // How many business days are between\n * // 1 November 2021 and 1 December 2021?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 1),\n *   new Date(2021, 11, 1)\n * )\n * //=> -22\n *\n * // How many business days are between\n * // 1 November 2021 and 1 November 2021 ?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 1),\n *   new Date(2021, 10, 1)\n * )\n * //=> 0\n */\nexport function differenceInBusinessDays(dateLeft, dateRight) {\n  const _dateLeft = toDate(dateLeft);\n  let _dateRight = toDate(dateRight);\n  if (!isValid(_dateLeft) || !isValid(_dateRight)) return NaN;\n  const calendarDifference = differenceInCalendarDays(_dateLeft, _dateRight);\n  const sign = calendarDifference < 0 ? -1 : 1;\n  const weeks = Math.trunc(calendarDifference / 7);\n  let result = weeks * 5;\n  _dateRight = addDays(_dateRight, weeks * 7);\n\n  // the loop below will run at most 6 times to account for the remaining days that don't makeup a full week\n  while (!isSameDay(_dateLeft, _dateRight)) {\n    // sign is used to account for both negative and positive differences\n    result += isWeekend(_dateRight) ? 0 : sign;\n    _dateRight = addDays(_dateRight, sign);\n  }\n\n  // Prevent negative zero\n  return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInBusinessDays;","map":{"version":3,"names":["addDays","differenceInCalendarDays","isSameDay","isValid","isWeekend","toDate","differenceInBusinessDays","dateLeft","dateRight","_dateLeft","_dateRight","NaN","calendarDifference","sign","weeks","Math","trunc","result"],"sources":["/root/rfcontavagas_hom/12.-Servidor-local-Docker/Front-Parking-Angular/node_modules/date-fns/differenceInBusinessDays.mjs"],"sourcesContent":["import { addDays } from \"./addDays.mjs\";\nimport { differenceInCalendarDays } from \"./differenceInCalendarDays.mjs\";\nimport { isSameDay } from \"./isSameDay.mjs\";\nimport { isValid } from \"./isValid.mjs\";\nimport { isWeekend } from \"./isWeekend.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInBusinessDays\n * @category Day Helpers\n * @summary Get the number of business days between the given dates.\n *\n * @description\n * Get the number of business day periods between the given dates.\n * Business days being days that arent in the weekend.\n * Like `differenceInCalendarDays`, the function removes the times from\n * the dates before calculating the difference.\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 business days\n *\n * @example\n * // How many business days are between\n * // 10 January 2014 and 20 July 2014?\n * const result = differenceInBusinessDays(\n *   new Date(2014, 6, 20),\n *   new Date(2014, 0, 10)\n * )\n * //=> 136\n *\n * // How many business days are between\n * // 30 November 2021 and 1 November 2021?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 30),\n *   new Date(2021, 10, 1)\n * )\n * //=> 21\n *\n * // How many business days are between\n * // 1 November 2021 and 1 December 2021?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 1),\n *   new Date(2021, 11, 1)\n * )\n * //=> -22\n *\n * // How many business days are between\n * // 1 November 2021 and 1 November 2021 ?\n * const result = differenceInBusinessDays(\n *   new Date(2021, 10, 1),\n *   new Date(2021, 10, 1)\n * )\n * //=> 0\n */\nexport function differenceInBusinessDays(dateLeft, dateRight) {\n  const _dateLeft = toDate(dateLeft);\n  let _dateRight = toDate(dateRight);\n\n  if (!isValid(_dateLeft) || !isValid(_dateRight)) return NaN;\n\n  const calendarDifference = differenceInCalendarDays(_dateLeft, _dateRight);\n  const sign = calendarDifference < 0 ? -1 : 1;\n\n  const weeks = Math.trunc(calendarDifference / 7);\n\n  let result = weeks * 5;\n  _dateRight = addDays(_dateRight, weeks * 7);\n\n  // the loop below will run at most 6 times to account for the remaining days that don't makeup a full week\n  while (!isSameDay(_dateLeft, _dateRight)) {\n    // sign is used to account for both negative and positive differences\n    result += isWeekend(_dateRight) ? 0 : sign;\n    _dateRight = addDays(_dateRight, sign);\n  }\n\n  // Prevent negative zero\n  return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInBusinessDays;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAACC,QAAQ,EAAEC,SAAS,EAAE;EAC5D,MAAMC,SAAS,GAAGJ,MAAM,CAACE,QAAQ,CAAC;EAClC,IAAIG,UAAU,GAAGL,MAAM,CAACG,SAAS,CAAC;EAElC,IAAI,CAACL,OAAO,CAACM,SAAS,CAAC,IAAI,CAACN,OAAO,CAACO,UAAU,CAAC,EAAE,OAAOC,GAAG;EAE3D,MAAMC,kBAAkB,GAAGX,wBAAwB,CAACQ,SAAS,EAAEC,UAAU,CAAC;EAC1E,MAAMG,IAAI,GAAGD,kBAAkB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;EAE5C,MAAME,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACJ,kBAAkB,GAAG,CAAC,CAAC;EAEhD,IAAIK,MAAM,GAAGH,KAAK,GAAG,CAAC;EACtBJ,UAAU,GAAGV,OAAO,CAACU,UAAU,EAAEI,KAAK,GAAG,CAAC,CAAC;;EAE3C;EACA,OAAO,CAACZ,SAAS,CAACO,SAAS,EAAEC,UAAU,CAAC,EAAE;IACxC;IACAO,MAAM,IAAIb,SAAS,CAACM,UAAU,CAAC,GAAG,CAAC,GAAGG,IAAI;IAC1CH,UAAU,GAAGV,OAAO,CAACU,UAAU,EAAEG,IAAI,CAAC;EACxC;;EAEA;EACA,OAAOI,MAAM,KAAK,CAAC,GAAG,CAAC,GAAGA,MAAM;AAClC;;AAEA;AACA,eAAeX,wBAAwB","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}