isSameQuarter.d.mts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @name isSameQuarter
  3. * @category Quarter Helpers
  4. * @summary Are the given dates in the same quarter (and year)?
  5. *
  6. * @description
  7. * Are the given dates in the same quarter (and year)?
  8. *
  9. * @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).
  10. *
  11. * @param dateLeft - The first date to check
  12. * @param dateRight - The second date to check
  13. * @returns The dates are in the same quarter (and year)
  14. *
  15. * @example
  16. * // Are 1 January 2014 and 8 March 2014 in the same quarter?
  17. * const result = isSameQuarter(new Date(2014, 0, 1), new Date(2014, 2, 8))
  18. * //=> true
  19. *
  20. * @example
  21. * // Are 1 January 2014 and 1 January 2015 in the same quarter?
  22. * const result = isSameQuarter(new Date(2014, 0, 1), new Date(2015, 0, 1))
  23. * //=> false
  24. */
  25. export declare function isSameQuarter<DateType extends Date>(
  26. dateLeft: DateType | number | string,
  27. dateRight: DateType | number | string,
  28. ): boolean;