formatRFC7231.d.cts 714 B

12345678910111213141516171819202122
  1. import type { DateArg } from "./types.js";
  2. /**
  3. * @name formatRFC7231
  4. * @category Common Helpers
  5. * @summary Format the date according to the RFC 7231 standard (https://tools.ietf.org/html/rfc7231#section-7.1.1.1).
  6. *
  7. * @description
  8. * Return the formatted date string in RFC 7231 format.
  9. * The result will always be in UTC timezone.
  10. *
  11. * @param date - The original date
  12. *
  13. * @returns The formatted date string
  14. *
  15. * @throws `date` must not be Invalid Date
  16. *
  17. * @example
  18. * // Represent 18 September 2019 in RFC 7231 format:
  19. * const result = formatRFC7231(new Date(2019, 8, 18, 19, 0, 52))
  20. * //=> 'Wed, 18 Sep 2019 19:00:52 GMT'
  21. */
  22. export declare function formatRFC7231(date: DateArg<Date> & {}): string;