{"ast":null,"code":"import { addDays } from \"./addDays.mjs\";\nimport { toDate } from \"./toDate.mjs\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.mjs\";\n\n/**\n * The {@link setDay} function options.\n */\n\n/**\n * @name setDay\n * @category Weekday Helpers\n * @summary Set the day of the week to the given date.\n *\n * @description\n * Set the day of the week to 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 day - The day of the week of the new date\n * @param options - An object with options.\n *\n * @returns The new date with the day of the week set\n *\n * @example\n * // Set week day to Sunday, with the default weekStartsOn of Sunday:\n * const result = setDay(new Date(2014, 8, 1), 0)\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // Set week day to Sunday, with a weekStartsOn of Monday:\n * const result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport function setDay(date, day, options) {\n  const defaultOptions = getDefaultOptions();\n  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;\n  const _date = toDate(date);\n  const currentDay = _date.getDay();\n  const remainder = day % 7;\n  const dayIndex = (remainder + 7) % 7;\n  const delta = 7 - weekStartsOn;\n  const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;\n  return addDays(_date, diff);\n}\n\n// Fallback for modularized imports:\nexport default setDay;","map":{"version":3,"names":["addDays","toDate","getDefaultOptions","setDay","date","day","options","defaultOptions","weekStartsOn","locale","_date","currentDay","getDay","remainder","dayIndex","delta","diff"],"sources":["/root/rfcontavagas_hom/12.-Servidor-local-Docker/Front-Parking-Angular/node_modules/date-fns/setDay.mjs"],"sourcesContent":["import { addDays } from \"./addDays.mjs\";\nimport { toDate } from \"./toDate.mjs\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.mjs\";\n\n/**\n * The {@link setDay} function options.\n */\n\n/**\n * @name setDay\n * @category Weekday Helpers\n * @summary Set the day of the week to the given date.\n *\n * @description\n * Set the day of the week to 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 day - The day of the week of the new date\n * @param options - An object with options.\n *\n * @returns The new date with the day of the week set\n *\n * @example\n * // Set week day to Sunday, with the default weekStartsOn of Sunday:\n * const result = setDay(new Date(2014, 8, 1), 0)\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // Set week day to Sunday, with a weekStartsOn of Monday:\n * const result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport function setDay(date, day, options) {\n  const defaultOptions = getDefaultOptions();\n  const weekStartsOn =\n    options?.weekStartsOn ??\n    options?.locale?.options?.weekStartsOn ??\n    defaultOptions.weekStartsOn ??\n    defaultOptions.locale?.options?.weekStartsOn ??\n    0;\n\n  const _date = toDate(date);\n  const currentDay = _date.getDay();\n\n  const remainder = day % 7;\n  const dayIndex = (remainder + 7) % 7;\n\n  const delta = 7 - weekStartsOn;\n  const diff =\n    day < 0 || day > 6\n      ? day - ((currentDay + delta) % 7)\n      : ((dayIndex + delta) % 7) - ((currentDay + delta) % 7);\n  return addDays(_date, diff);\n}\n\n// Fallback for modularized imports:\nexport default setDay;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,iBAAiB,QAAQ,2BAA2B;;AAE7D;AACA;AACA;;AAEA;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,MAAMA,CAACC,IAAI,EAAEC,GAAG,EAAEC,OAAO,EAAE;EACzC,MAAMC,cAAc,GAAGL,iBAAiB,CAAC,CAAC;EAC1C,MAAMM,YAAY,GAChBF,OAAO,EAAEE,YAAY,IACrBF,OAAO,EAAEG,MAAM,EAAEH,OAAO,EAAEE,YAAY,IACtCD,cAAc,CAACC,YAAY,IAC3BD,cAAc,CAACE,MAAM,EAAEH,OAAO,EAAEE,YAAY,IAC5C,CAAC;EAEH,MAAME,KAAK,GAAGT,MAAM,CAACG,IAAI,CAAC;EAC1B,MAAMO,UAAU,GAAGD,KAAK,CAACE,MAAM,CAAC,CAAC;EAEjC,MAAMC,SAAS,GAAGR,GAAG,GAAG,CAAC;EACzB,MAAMS,QAAQ,GAAG,CAACD,SAAS,GAAG,CAAC,IAAI,CAAC;EAEpC,MAAME,KAAK,GAAG,CAAC,GAAGP,YAAY;EAC9B,MAAMQ,IAAI,GACRX,GAAG,GAAG,CAAC,IAAIA,GAAG,GAAG,CAAC,GACdA,GAAG,GAAI,CAACM,UAAU,GAAGI,KAAK,IAAI,CAAE,GAC/B,CAACD,QAAQ,GAAGC,KAAK,IAAI,CAAC,GAAK,CAACJ,UAAU,GAAGI,KAAK,IAAI,CAAE;EAC3D,OAAOf,OAAO,CAACU,KAAK,EAAEM,IAAI,CAAC;AAC7B;;AAEA;AACA,eAAeb,MAAM","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}