getDecade.d.mts 640 B

12345678910111213141516171819202122
  1. /**
  2. * @name getDecade
  3. * @category Decade Helpers
  4. * @summary Get the decade of the given date.
  5. *
  6. * @description
  7. * Get the decade of the given date.
  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 date - The given date
  12. *
  13. * @returns The year of decade
  14. *
  15. * @example
  16. * // Which decade belongs 27 November 1942?
  17. * const result = getDecade(new Date(1942, 10, 27))
  18. * //=> 1940
  19. */
  20. export declare function getDecade<DateType extends Date>(
  21. date: DateType | number | string,
  22. ): number;