MCPcopy
hub / github.com/nodejs/undici / parseHttpDate

Function parseHttpDate

lib/util/date.js:9–19  ·  view source on GitHub ↗

* @see https://www.rfc-editor.org/rfc/rfc9110.html#name-date-time-formats * * @param {string} date * @returns {Date | undefined}

(date)

Source from the content-addressed store, hash-verified

7 * @returns {Date | undefined}
8 */
9function parseHttpDate (date) {
10 // Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate
11 // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
12 // Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format
13
14 switch (date[3]) {
15 case ',': return parseImfDate(date)
16 case ' ': return parseAscTimeDate(date)
17 default: return parseRfc850Date(date)
18 }
19}
20
21/**
22 * @see https://httpwg.org/specs/rfc9110.html#preferred.date.format

Callers 5

date.mjsFile · 0.90
date.mjsFile · 0.90
onResponseStartMethod · 0.85
determineStaleAtFunction · 0.85
date.jsFile · 0.85

Calls 3

parseImfDateFunction · 0.85
parseAscTimeDateFunction · 0.85
parseRfc850DateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…