Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update datetime parser to handle (ignore) named timezone offsets #183

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

andrewtimberlake
Copy link
Collaborator

Sometimes timestamps are used with a named timezone offset (like Tue, 05 Nov 2024 10:31:43 MSK) instead of the numeric offset (+0300)
This change ignores those time zones and parses the date as UTC
Fixes test in #182

giniouxe and others added 2 commits November 6, 2024 09:41
The timezone seem to be invalid according to RFC 2822, but I'm not
totally sure, and since some other invalid datetime seem to be
handled by the RFC2822 parser, I'm still submitting this case.
Causes the following error:
```
(MatchError) no match of right hand side value: {:error, :invalid_format}
    (mail 0.4.2) lib/mail/parsers/rfc_2822.ex:153: Mail.Parsers.RFC2822.to_datetime/1
    (mail 0.4.2) lib/mail/parsers/rfc_2822.ex:463: Mail.Parsers.RFC2822.parse_received_value/1
    (mail 0.4.2) lib/mail/parsers/rfc_2822.ex:313: Mail.Parsers.RFC2822.parse_headers/3
    (mail 0.4.2) lib/mail/parsers/rfc_2822.ex:56: Mail.Parsers.RFC2822.parse/2
```
as reproduced in the failing test.
Copy link
Contributor

@giniouxe giniouxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@giniouxe
Copy link
Contributor

When do you think this will be released?
Have a nice day.

@andrewtimberlake andrewtimberlake merged commit 5db807b into DockYard:master Nov 15, 2024
12 checks passed
@andrewtimberlake
Copy link
Collaborator Author

Sorry, thanks for the reminder.

@giniouxe
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants