setISODay.d.ts 880 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @name setISODay
  3. * @category Weekday Helpers
  4. * @summary Set the day of the ISO week to the given date.
  5. *
  6. * @description
  7. * Set the day of the ISO week to the given date.
  8. * ISO week starts with Monday.
  9. * 7 is the index of Sunday, 1 is the index of Monday etc.
  10. *
  11. * @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).
  12. *
  13. * @param date - The date to be changed
  14. * @param day - The day of the ISO week of the new date
  15. *
  16. * @returns The new date with the day of the ISO week set
  17. *
  18. * @example
  19. * // Set Sunday to 1 September 2014:
  20. * const result = setISODay(new Date(2014, 8, 1), 7)
  21. * //=> Sun Sep 07 2014 00:00:00
  22. */
  23. export declare function setISODay<DateType extends Date>(
  24. date: DateType | number | string,
  25. day: number,
  26. ): DateType;