///|
/// Parse any RFC 9110 HTTP-date form relative to the supplied current time.
pub fn parse_http_date(value : String, now : Timestamp) -> Timestamp? {
  @httpdate.parse(value, now)
}

///|
/// Format a timestamp using IMF-fixdate, the preferred HTTP wire format.
pub fn format_http_date(value : Timestamp) -> String? {
  @httpdate.format(value)
}

///|
/// Read a date-valued header. Invalid or repeated values are treated as absent.
pub fn header_date(
  headers : Headers,
  name : String,
  now : Timestamp,
) -> Timestamp? {
  let values = headers.values(name)
  if values.length() != 1 {
    return None
  }
  parse_http_date(values[0], now)
}