rfc2822DateTime
const rfc2822DateTime: RegExp = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun), )?(\d{1,2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{2}):(\d{2})(?::(\d{2}))? (UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[+-]\d{4})$/;RegExp matching the strict shape of an RFC 5322 §3.3 date-time (obsoletes RFC 2822): the single-space, case-exact form a generator writes. English day/month names are mandated by the spec regardless of locale — see internal/englishCalendarNames.ts. Day is 1*2DIGIT per the formal grammar, so single-digit days are valid even though GMT’s own formatter always emits the zero-padded 2-digit form. zone accepts a numeric offset or one of the obsolete named zones RFC 5322 §4.3 lists (UT/GMT plus the eight North American zones).
Examples
Section titled “Examples”import { rfc2822DateTime } from "@northguild/gmt";rfc2822DateTime.test("Wed, 09 Jun 2021 10:18:14 GMT") // truerfc2822DateTime.test("09 Jun 2021 10:18:14 +0000") // true (no weekday)rfc2822DateTime.test("9 Jun 2021 10:18:14 PST") // true (single-digit day)rfc2822DateTime.test("Wed, 09 Jun 2021 10:18:14 EST") // true (named zone)rfc2822DateTime.test("Wed, 09 Jun 2021 10:18:14 -0400 (EDT)") // false (comment: valid RFC 5322, parseRfc2822 reads it)rfc2822DateTime.test("2024-03-15T14:30:00Z") // false (ISO shape)