lastDayOfISOWeekYear.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link lastDayOfISOWeekYear} function options.
  4. */
  5. export interface LastDayOfISOWeekYearOptions<DateType extends Date = Date>
  6. extends ContextOptions<DateType> {}
  7. /**
  8. * @name lastDayOfISOWeekYear
  9. * @category ISO Week-Numbering Year Helpers
  10. * @summary Return the last day of an ISO week-numbering year for the given date.
  11. *
  12. * @description
  13. * Return the last day of an ISO week-numbering year,
  14. * which always starts 3 days before the year's first Thursday.
  15. * The result will be in the local timezone.
  16. *
  17. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  18. *
  19. * @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).
  20. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  21. *
  22. * @param date - The original date
  23. * @param options - An object with options
  24. *
  25. * @returns The end of an ISO week-numbering year
  26. *
  27. * @example
  28. * // The last day of an ISO week-numbering year for 2 July 2005:
  29. * const result = lastDayOfISOWeekYear(new Date(2005, 6, 2))
  30. * //=> Sun Jan 01 2006 00:00:00
  31. */
  32. export declare function lastDayOfISOWeekYear<
  33. DateType extends Date,
  34. ResultDate extends Date = DateType,
  35. >(
  36. date: DateArg<DateType>,
  37. options?: LastDayOfISOWeekYearOptions<ResultDate> | undefined,
  38. ): ResultDate;