-
Notifications
You must be signed in to change notification settings - Fork 546
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
Bug in parse_from_rfc2822 with -0000 timezone #102
Comments
My understanding is that |
Right. The spec is a little hard to read on this. I did notice that python's email.utils parsedate_tz treats +0000 the same as -0000, and gnu date seems to as well. I guess it's fine either way, but certainly some email clients seem to put -0000 in the date field, meaning if you're parsing those you need to do extra work to transform them to +0000 (or something else) |
Any update on this ? |
Quite one year elapsed, and no advance on this subject ? Is it possible to help ? |
As I read RFC 5322 (not that the text changed from RFC2822), -0000 still indicates that the timestamp is to be semantically interpreted as UTC. Local time is discussed as something that clients should express, but the offset described is the offset of the time-of-day, not the offset of local time from UTC. When it's again discussed at the end of the paragraph, it mentions that -0000 "also" indicates UTC but also indicates that the system's time zone may not be (i.e., is not necessarily) in UTC, and then clarifies more succinctly that the date-time contains no information about the local time zone. In other words, +0000 means that you should return a DateTimeFixedOffset::east(0), while -0000 means that you really want to return a DateTime instead. In the current implementation, there's no way to disambiguate these two interpretations, but if you allowed DateTime<Option>, it could be done. |
For all practical reasons I would like to have -0000 parse same as +0000, if there are no arguments against it - I will provide a PR. |
@lifthrasiir Please let us know what we can do here, it's not only python that does it, time 0.1 also generates rfc822 time with -0000: https://docs.diesel.rs/time/struct.Tm.html#method.rfc822z. |
I agree that the following sentences from RFC 5322 all say that
and this in particular seems to suggest that
And:
And from the apendix:
|
which is all to say I am happy to take a PR that interprets |
This is a time that is commonly set in some environments, and RFC 5322 explicitly clarifies that we should treat -0000 as UTC[1][2] when interpretting rfc2822. Fixes chronotope#102 [1]: chronotope#102 (comment) [2]: https://tools.ietf.org/html/rfc5322#section-3.3
This is a time that is commonly set in some environments, and RFC 5322 explicitly clarifies that we should treat -0000 as UTC[1][2] when interpretting rfc2822. Fixes chronotope#102 [1]: chronotope#102 (comment) [2]: https://tools.ietf.org/html/rfc5322#section-3.3
The following program:
outputs:
This seems wrong. There should be no difference between -0000 and +0000 right?
The text was updated successfully, but these errors were encountered: