toRFC2822
Converts a date to RFC 2822 format Format: Day, DD Mon YYYY HH:mm:ss +0000 Used in email headers (Date field) and HTTP headers
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
date | DateLike | Date to convert (Date object, timestamp, or date string) |
Returns
Section titled “Returns”string | null — RFC 2822 formatted string or null if invalid date
Examples
Section titled “Examples”toRFC2822
Section titled “toRFC2822”Related Types
Section titled “Related Types”DateLike
Section titled “DateLike”A value that can be converted to a Date.
Date— used as-is (validated for Invalid Date)number— treated as a timestamp (seconds or milliseconds, auto-detected);0is treated as invalid and producesnullin ensureDatestring— parsed vianew Date(string)Temporal.Instant|Temporal.ZonedDateTime— read via theirepochMillisecondsproperty
