mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
1 line
6.1 KiB
JSON
1 line
6.1 KiB
JSON
{"ast":null,"code":"import addHours from \"../addHours/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name eachHourOfInterval\n * @category Interval Helpers\n * @summary Return the array of hours within the specified time interval.\n *\n * @description\n * Return the array of hours within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.\n * @returns {Date[]} the array with starts of hours from the hour of the interval start to the hour of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.step` must be a number greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each hour between 6 October 2014, 12:00 and 6 October 2014, 15:00\n * var result = eachHourOfInterval({\n * start: new Date(2014, 9, 6, 12),\n * end: new Date(2014, 9, 6, 15)\n * })\n * //=> [\n * // Mon Oct 06 2014 12:00:00,\n * // Mon Oct 06 2014 13:00:00,\n * // Mon Oct 06 2014 14:00:00,\n * // Mon Oct 06 2014 15:00:00\n * // ]\n */\nexport default function eachHourOfInterval(dirtyInterval, options) {\n requiredArgs(1, arguments);\n var interval = dirtyInterval || {};\n var startDate = toDate(interval.start);\n var endDate = toDate(interval.end);\n var startTime = startDate.getTime();\n var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`\n\n if (!(startTime <= endTime)) {\n throw new RangeError('Invalid interval');\n }\n var dates = [];\n var currentDate = startDate;\n currentDate.setMinutes(0, 0, 0);\n var step = options && 'step' in options ? Number(options.step) : 1;\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate = addHours(currentDate, step);\n }\n return dates;\n}","map":{"version":3,"names":["addHours","toDate","requiredArgs","eachHourOfInterval","dirtyInterval","options","arguments","interval","startDate","start","endDate","end","startTime","getTime","endTime","RangeError","dates","currentDate","setMinutes","step","Number","isNaN","push"],"sources":["C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/date-fns/esm/eachHourOfInterval/index.js"],"sourcesContent":["import addHours from \"../addHours/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name eachHourOfInterval\n * @category Interval Helpers\n * @summary Return the array of hours within the specified time interval.\n *\n * @description\n * Return the array of hours within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.\n * @returns {Date[]} the array with starts of hours from the hour of the interval start to the hour of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.step` must be a number greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each hour between 6 October 2014, 12:00 and 6 October 2014, 15:00\n * var result = eachHourOfInterval({\n * start: new Date(2014, 9, 6, 12),\n * end: new Date(2014, 9, 6, 15)\n * })\n * //=> [\n * // Mon Oct 06 2014 12:00:00,\n * // Mon Oct 06 2014 13:00:00,\n * // Mon Oct 06 2014 14:00:00,\n * // Mon Oct 06 2014 15:00:00\n * // ]\n */\nexport default function eachHourOfInterval(dirtyInterval, options) {\n requiredArgs(1, arguments);\n var interval = dirtyInterval || {};\n var startDate = toDate(interval.start);\n var endDate = toDate(interval.end);\n var startTime = startDate.getTime();\n var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`\n\n if (!(startTime <= endTime)) {\n throw new RangeError('Invalid interval');\n }\n\n var dates = [];\n var currentDate = startDate;\n currentDate.setMinutes(0, 0, 0);\n var step = options && 'step' in options ? Number(options.step) : 1;\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');\n\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate = addHours(currentDate, step);\n }\n\n return dates;\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,YAAY,MAAM,+BAA+B;;AAExD;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,eAAe,SAASC,kBAAkBA,CAACC,aAAa,EAAEC,OAAO,EAAE;EACjEH,YAAY,CAAC,CAAC,EAAEI,SAAS,CAAC;EAC1B,IAAIC,QAAQ,GAAGH,aAAa,IAAI,CAAC,CAAC;EAClC,IAAII,SAAS,GAAGP,MAAM,CAACM,QAAQ,CAACE,KAAK,CAAC;EACtC,IAAIC,OAAO,GAAGT,MAAM,CAACM,QAAQ,CAACI,GAAG,CAAC;EAClC,IAAIC,SAAS,GAAGJ,SAAS,CAACK,OAAO,CAAC,CAAC;EACnC,IAAIC,OAAO,GAAGJ,OAAO,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC;;EAEjC,IAAI,EAAED,SAAS,IAAIE,OAAO,CAAC,EAAE;IAC3B,MAAM,IAAIC,UAAU,CAAC,kBAAkB,CAAC;EAC1C;EAEA,IAAIC,KAAK,GAAG,EAAE;EACd,IAAIC,WAAW,GAAGT,SAAS;EAC3BS,WAAW,CAACC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EAC/B,IAAIC,IAAI,GAAGd,OAAO,IAAI,MAAM,IAAIA,OAAO,GAAGe,MAAM,CAACf,OAAO,CAACc,IAAI,CAAC,GAAG,CAAC;EAClE,IAAIA,IAAI,GAAG,CAAC,IAAIE,KAAK,CAACF,IAAI,CAAC,EAAE,MAAM,IAAIJ,UAAU,CAAC,gDAAgD,CAAC;EAEnG,OAAOE,WAAW,CAACJ,OAAO,CAAC,CAAC,IAAIC,OAAO,EAAE;IACvCE,KAAK,CAACM,IAAI,CAACrB,MAAM,CAACgB,WAAW,CAAC,CAAC;IAC/BA,WAAW,GAAGjB,QAAQ,CAACiB,WAAW,EAAEE,IAAI,CAAC;EAC3C;EAEA,OAAOH,KAAK;AACd"},"metadata":{},"sourceType":"module"} |