A day of the month: 1-31 depending on the month
Hour of the day in 24 time: 0-23
Millisecond of the second: 0-999
Minute of the hour: 0-59
A month of the year: 1-12
The full, four digit year.
import {toHttpDateString} from 'date-vir';
const exampleDate: FullDate = {
year: 2024,
month: 1,
day: 5,
hour: 1,
minute: 1,
second: 1,
millisecond: 1,
timezone: 'UTC',
};
toHttpDateString(exampleDate); // `'Fri, 05 Jan 2024 01:01:01 GMT'`
toUtcIsoString for the ISO 8601 format.
Convert a FullDate into an RFC 1123 / HTTP-date string in GMT (for example
'Fri, 05 Jan 2024 01:01:01 GMT'). This is the format used by HTTP headers (per RFC 9110), and is identical to whatDate.prototype.toUTCString()produces for the same instant.This is distinct from toUtcIsoString, which produces the ISO 8601 format (
'2024-01-05T01:01:01.001Z'). Both represent the same instant in UTC, but they are not interchangeable: use this RFC 1123 form wherever an HTTP date is expected (e.g.Date,Last-Modified,Expires, orRetry-Afterheaders), and use toUtcIsoString where ISO 8601 is expected. The output is always rendered in GMT regardless of the input's timezone.