Skip to content

Date parsing bug or working as intended? #160

@telemachus

Description

@telemachus

First, thank you very much for letters. I've been enjoying working with it.

If an email's headers has a date in the format "Thu, 14 Aug 2025 14:15:52 GMT", letters will not parse it. (That is, the return value of email.Headers.Date is a zero value time.Time.)

This may be working as intended since ParseDateHeader tries time.RFC1123Z but not time.RFC1123.

On the other hand, I wonder whether this is the right choice. If I am reading RFC 5322's section on dates correctly, "Thu, 14 Aug 2025 14:15:52 GMT" is a valid date format. It uses an "obsolete time zone" instead of the (preferred) numeric offset, but that doesn't make it an invalid format. The RFC specifies that such obsolete "forms MUST NOT be generated...,they MUST be accepted and parsed by a conformant receiver."

I know that it's possible to swap in a different parser (great design choice, by the way!), and I've done that to handle some of the emails in my situation. But I still wanted to confirm that you intentionally omit time.RFC1123 from ParseDateHeader. (If not, I'm happy to submit a PR and test.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions