endOfDecade.d.cts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link endOfDecade} function options.
  4. */
  5. export interface EndOfDecadeOptions<DateType extends Date = Date>
  6. extends ContextOptions<DateType> {}
  7. /**
  8. * @name endOfDecade
  9. * @category Decade Helpers
  10. * @summary Return the end of a decade for the given date.
  11. *
  12. * @description
  13. * Return the end of a decade for the given date.
  14. *
  15. * @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).
  16. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  17. *
  18. * @param date - The original date
  19. * @param options - An object with options
  20. *
  21. * @returns The end of a decade
  22. *
  23. * @example
  24. * // The end of a decade for 12 May 1984 00:00:00:
  25. * const result = endOfDecade(new Date(1984, 4, 12, 00, 00, 00))
  26. * //=> Dec 31 1989 23:59:59.999
  27. */
  28. export declare function endOfDecade<
  29. DateType extends Date,
  30. ResultDate extends Date = DateType,
  31. >(
  32. date: DateArg<DateType>,
  33. options?: EndOfDecadeOptions<ResultDate> | undefined,
  34. ): ResultDate;