{"ast":null,"code":"import { isValid } from \"./isValid.mjs\";\nimport { toDate } from \"./toDate.mjs\";\nimport { addLeadingZeros } from \"./_lib/addLeadingZeros.mjs\";\nconst days = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\nconst months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\n/**\n * @name formatRFC7231\n * @category Common Helpers\n * @summary Format the date according to the RFC 7231 standard (https://tools.ietf.org/html/rfc7231#section-7.1.1.1).\n *\n * @description\n * Return the formatted date string in RFC 7231 format.\n * The result will always be in UTC timezone.\n *\n * @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).\n *\n * @param date - The original date\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n *\n * @example\n * // Represent 18 September 2019 in RFC 7231 format:\n * const result = formatRFC7231(new Date(2019, 8, 18, 19, 0, 52))\n * //=> 'Wed, 18 Sep 2019 19:00:52 GMT'\n */\nexport function formatRFC7231(date) {\n  const _date = toDate(date);\n  if (!isValid(_date)) {\n    throw new RangeError(\"Invalid time value\");\n  }\n  const dayName = days[_date.getUTCDay()];\n  const dayOfMonth = addLeadingZeros(_date.getUTCDate(), 2);\n  const monthName = months[_date.getUTCMonth()];\n  const year = _date.getUTCFullYear();\n  const hour = addLeadingZeros(_date.getUTCHours(), 2);\n  const minute = addLeadingZeros(_date.getUTCMinutes(), 2);\n  const second = addLeadingZeros(_date.getUTCSeconds(), 2);\n\n  // Result variables.\n  return `${dayName}, ${dayOfMonth} ${monthName} ${year} ${hour}:${minute}:${second} GMT`;\n}\n\n// Fallback for modularized imports:\nexport default formatRFC7231;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}