eachQuarterOfInterval.d.mts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import type { Interval, StepOptions } from "./types.js";
  2. /**
  3. * The {@link eachQuarterOfInterval} function options.
  4. */
  5. export interface EachQuarterOfIntervalOptions extends StepOptions {}
  6. /**
  7. * @name eachQuarterOfInterval
  8. * @category Interval Helpers
  9. * @summary Return the array of quarters within the specified time interval.
  10. *
  11. * @description
  12. * Return the array of quarters within the specified time interval.
  13. *
  14. * @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).
  15. *
  16. * @param interval - The interval
  17. *
  18. * @returns The array with starts of quarters from the quarter of the interval start to the quarter of the interval end
  19. *
  20. * @example
  21. * // Each quarter within interval 6 February 2014 - 10 August 2014:
  22. * const result = eachQuarterOfInterval({
  23. * start: new Date(2014, 1, 6),
  24. * end: new Date(2014, 7, 10)
  25. * })
  26. * //=> [
  27. * // Wed Jan 01 2014 00:00:00,
  28. * // Tue Apr 01 2014 00:00:00,
  29. * // Tue Jul 01 2014 00:00:00,
  30. * // ]
  31. */
  32. export declare function eachQuarterOfInterval<DateType extends Date>(
  33. interval: Interval<DateType>,
  34. options?: EachQuarterOfIntervalOptions,
  35. ): DateType[];