startOfSecond.d.mts 792 B

1234567891011121314151617181920212223
  1. /**
  2. * @name startOfSecond
  3. * @category Second Helpers
  4. * @summary Return the start of a second for the given date.
  5. *
  6. * @description
  7. * Return the start of a second for the given date.
  8. * The result will be in the local timezone.
  9. *
  10. * @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).
  11. *
  12. * @param date - The original date
  13. *
  14. * @returns The start of a second
  15. *
  16. * @example
  17. * // The start of a second for 1 December 2014 22:15:45.400:
  18. * const result = startOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))
  19. * //=> Mon Dec 01 2014 22:15:45.000
  20. */
  21. export declare function startOfSecond<DateType extends Date>(
  22. date: DateType | number | string,
  23. ): DateType;