Parsing and formatting for the HTTP Date: header

Build Status Crates.io Documentation

Multiple HTTP header fields store timestamps. For example, a response created on May 15, 2015 may contain the header Date: Fri, 15 May 2015 15:34:21 GMT. Since the timestamp does not contain any timezone or leap second information, it is equvivalent to writing 1431696861 Unix time.

This crate provides two functions:

The date header is technically supposed to contain an IMF-fixdate value, but three formats actually exist in the wild. This crate attempts parsing all three when calling parse.

This is a fork of https://github.com/pyfisch/httpdate to fix some things that I found mildily annoying while using it.

Changes include:

Here's a link to pyfisch's blog post on the original crate: https://pyfisch.org/blog/http-datetime-handling/