lastDayOfWeek.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import type {
  2. ContextOptions,
  3. DateArg,
  4. LocalizedOptions,
  5. WeekOptions,
  6. } from "./types.js";
  7. /**
  8. * The {@link lastDayOfWeek} function options.
  9. */
  10. export interface LastDayOfWeekOptions<DateType extends Date = Date>
  11. extends LocalizedOptions<"options">,
  12. WeekOptions,
  13. ContextOptions<DateType> {}
  14. /**
  15. * @name lastDayOfWeek
  16. * @category Week Helpers
  17. * @summary Return the last day of a week for the given date.
  18. *
  19. * @description
  20. * Return the last day of a week for the given date.
  21. * The result will be in the local timezone unless a context is specified.
  22. *
  23. * @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).
  24. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  25. *
  26. * @param date - The original date
  27. * @param options - An object with options
  28. *
  29. * @returns The last day of a week
  30. */
  31. export declare function lastDayOfWeek<
  32. DateType extends Date,
  33. ResultDate extends Date = DateType,
  34. >(
  35. date: DateArg<DateType>,
  36. options?: LastDayOfWeekOptions<ResultDate>,
  37. ): ResultDate;