{"ast":null,"code":"import { subDays } from \"./subDays.mjs\";\nimport { subMonths } from \"./subMonths.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name sub\n * @category Common Helpers\n * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @description\n * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\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 date - The date to be changed\n * @param duration - The object with years, months, weeks, days, hours, minutes and seconds to be subtracted\n *\n * | Key     | Description                        |\n * |---------|------------------------------------|\n * | years   | Amount of years to be subtracted   |\n * | months  | Amount of months to be subtracted  |\n * | weeks   | Amount of weeks to be subtracted   |\n * | days    | Amount of days to be subtracted    |\n * | hours   | Amount of hours to be subtracted   |\n * | minutes | Amount of minutes to be subtracted |\n * | seconds | Amount of seconds to be subtracted |\n *\n * All values default to 0\n *\n * @returns The new date with the seconds subtracted\n *\n * @example\n * // Subtract the following duration from 15 June 2017 15:29:20\n * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {\n *   years: 2,\n *   months: 9,\n *   weeks: 1,\n *   days: 7,\n *   hours: 5,\n *   minutes: 9,\n *   seconds: 30\n * })\n * //=> Mon Sep 1 2014 10:19:50\n */\nexport function sub(date, duration) {\n  const {\n    years = 0,\n    months = 0,\n    weeks = 0,\n    days = 0,\n    hours = 0,\n    minutes = 0,\n    seconds = 0\n  } = duration;\n\n  // Subtract years and months\n  const dateWithoutMonths = subMonths(date, months + years * 12);\n\n  // Subtract weeks and days\n  const dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7);\n\n  // Subtract hours, minutes and seconds\n  const minutestoSub = minutes + hours * 60;\n  const secondstoSub = seconds + minutestoSub * 60;\n  const mstoSub = secondstoSub * 1000;\n  const finalDate = constructFrom(date, dateWithoutDays.getTime() - mstoSub);\n  return finalDate;\n}\n\n// Fallback for modularized imports:\nexport default sub;","map":{"version":3,"names":["subDays","subMonths","constructFrom","sub","date","duration","years","months","weeks","days","hours","minutes","seconds","dateWithoutMonths","dateWithoutDays","minutestoSub","secondstoSub","mstoSub","finalDate","getTime"],"sources":["/root/rfcontavagas_hom/12.-Servidor-local-Docker/Front-Parking-Angular/node_modules/date-fns/sub.mjs"],"sourcesContent":["import { subDays } from \"./subDays.mjs\";\nimport { subMonths } from \"./subMonths.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name sub\n * @category Common Helpers\n * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @description\n * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\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 date - The date to be changed\n * @param duration - The object with years, months, weeks, days, hours, minutes and seconds to be subtracted\n *\n * | Key     | Description                        |\n * |---------|------------------------------------|\n * | years   | Amount of years to be subtracted   |\n * | months  | Amount of months to be subtracted  |\n * | weeks   | Amount of weeks to be subtracted   |\n * | days    | Amount of days to be subtracted    |\n * | hours   | Amount of hours to be subtracted   |\n * | minutes | Amount of minutes to be subtracted |\n * | seconds | Amount of seconds to be subtracted |\n *\n * All values default to 0\n *\n * @returns The new date with the seconds subtracted\n *\n * @example\n * // Subtract the following duration from 15 June 2017 15:29:20\n * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {\n *   years: 2,\n *   months: 9,\n *   weeks: 1,\n *   days: 7,\n *   hours: 5,\n *   minutes: 9,\n *   seconds: 30\n * })\n * //=> Mon Sep 1 2014 10:19:50\n */\nexport function sub(date, duration) {\n  const {\n    years = 0,\n    months = 0,\n    weeks = 0,\n    days = 0,\n    hours = 0,\n    minutes = 0,\n    seconds = 0,\n  } = duration;\n\n  // Subtract years and months\n  const dateWithoutMonths = subMonths(date, months + years * 12);\n\n  // Subtract weeks and days\n  const dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7);\n\n  // Subtract hours, minutes and seconds\n  const minutestoSub = minutes + hours * 60;\n  const secondstoSub = seconds + minutestoSub * 60;\n  const mstoSub = secondstoSub * 1000;\n  const finalDate = constructFrom(date, dateWithoutDays.getTime() - mstoSub);\n\n  return finalDate;\n}\n\n// Fallback for modularized imports:\nexport default sub;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,qBAAqB;;AAEnD;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,GAAGA,CAACC,IAAI,EAAEC,QAAQ,EAAE;EAClC,MAAM;IACJC,KAAK,GAAG,CAAC;IACTC,MAAM,GAAG,CAAC;IACVC,KAAK,GAAG,CAAC;IACTC,IAAI,GAAG,CAAC;IACRC,KAAK,GAAG,CAAC;IACTC,OAAO,GAAG,CAAC;IACXC,OAAO,GAAG;EACZ,CAAC,GAAGP,QAAQ;;EAEZ;EACA,MAAMQ,iBAAiB,GAAGZ,SAAS,CAACG,IAAI,EAAEG,MAAM,GAAGD,KAAK,GAAG,EAAE,CAAC;;EAE9D;EACA,MAAMQ,eAAe,GAAGd,OAAO,CAACa,iBAAiB,EAAEJ,IAAI,GAAGD,KAAK,GAAG,CAAC,CAAC;;EAEpE;EACA,MAAMO,YAAY,GAAGJ,OAAO,GAAGD,KAAK,GAAG,EAAE;EACzC,MAAMM,YAAY,GAAGJ,OAAO,GAAGG,YAAY,GAAG,EAAE;EAChD,MAAME,OAAO,GAAGD,YAAY,GAAG,IAAI;EACnC,MAAME,SAAS,GAAGhB,aAAa,CAACE,IAAI,EAAEU,eAAe,CAACK,OAAO,CAAC,CAAC,GAAGF,OAAO,CAAC;EAE1E,OAAOC,SAAS;AAClB;;AAEA;AACA,eAAef,GAAG","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}