getTime.d.ts 701 B

12345678910111213141516171819202122
  1. /**
  2. * @name getTime
  3. * @category Timestamp Helpers
  4. * @summary Get the milliseconds timestamp of the given date.
  5. *
  6. * @description
  7. * Get the milliseconds timestamp of the given date.
  8. *
  9. * @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).
  10. *
  11. * @param date - The given date
  12. *
  13. * @returns The timestamp
  14. *
  15. * @example
  16. * // Get the timestamp of 29 February 2012 11:45:05.123:
  17. * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))
  18. * //=> 1330515905123
  19. */
  20. export declare function getTime<DateType extends Date>(
  21. date: DateType | number | string,
  22. ): number;