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

Support RFC 822 datetime parsing #83

Closed
kevincianfarini opened this issue Dec 13, 2020 · 4 comments
Closed

Support RFC 822 datetime parsing #83

kevincianfarini opened this issue Dec 13, 2020 · 4 comments
Labels
formatters Related to parsing and formatting

Comments

@kevincianfarini
Copy link

kevincianfarini commented Dec 13, 2020

The RSS 2.0 specification denotes dates using RFC 822. My personal use case is that I'm writing a multiplatform RSS feed parser which would require date time parsing in this format.

I'm open to attempting a PR if the maintainers are interested.

 5.  DATE AND TIME SPECIFICATION
 
 5.1.  SYNTAX
 
 date-time   =  [ day "," ] date time        ; dd mm yy
                                             ;  hh:mm:ss zzz
 
 day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
             /  "Fri"  / "Sat" /  "Sun"
 
 date        =  1*2DIGIT month 2DIGIT        ; day month year
                                             ;  e.g. 20 Jun 82
 
 month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
             /  "May"  /  "Jun" /  "Jul"  /  "Aug"
             /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"
 
 time        =  hour zone                    ; ANSI and Military
 
 hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
                                             ; 00:00:00 - 23:59:59
 
 zone        =  "UT"  / "GMT"                ; Universal Time
                                             ; North American : UT
             /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
             /  "CST" / "CDT"                ;  Central:  - 6/ - 5
             /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
             /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
             /  1ALPHA                       ; Military: Z = UT;
                                             ;  A:-1; (J not used)
                                             ;  M:-12; N:+1; Y:+12
             / ( ("+" / "-") 4DIGIT )        ; Local differential
                                             ;  hours+min. (HHMM)
 
 5.2.  SEMANTICS
 
      If included, day-of-week must be the day implied by the date
 specification.
 
      Time zone may be indicated in several ways.  "UT" is Univer-
 sal  Time  (formerly called "Greenwich Mean Time"); "GMT" is per-
 mitted as a reference to Universal Time.  The  military  standard
 uses  a  single  character for each zone.  "Z" is Universal Time.
 "A" indicates one hour earlier, and "M" indicates 12  hours  ear-
 lier;  "N"  is  one  hour  later, and "Y" is 12 hours later.  The
 letter "J" is not used.  The other remaining two forms are  taken
 from ANSI standard X3.51-1975.  One allows explicit indication of
 the amount of offset from UT; the other uses  common  3-character
 strings for indicating time zones in North America.
 
 
 August 13, 1982              - 26 -                      RFC #822
@dkhalanskyjb
Copy link
Collaborator

We have plans to add a general mechanism for datetime formatting in the future, which would cover this use case. That said, having RFC-822 support in the meantime could also be nice, so if you did implement this, we would be glad to accept it. Just keep in mind that once the formatting API does land, the RFC-822-specific functions will be deprecated in favor of it. If you're okay with that, then please do go ahead!

@kevincianfarini
Copy link
Author

I'll see what I can do! I just started a new job so it might be a while. Thanks for responding!

@dkhalanskyjb dkhalanskyjb added the formatters Related to parsing and formatting label Jun 16, 2021
@svenjacobs
Copy link

I also need RFC 822 parsing for a multiplatform project. Did you get a chance to implement this @kevincianfarini?

@svenjacobs
Copy link

I now wrote my own RFC 822 parser. I wanted to contribute this to the project but I'm not able to compile the project on a MacBook with Apple Silicon chip. I guess a few obstacles need to be cleared first before I could start working on this.

dkhalanskyjb added a commit that referenced this issue Feb 20, 2024
Fixes #39
Fixes #58
Fixes #90
Fixes #128
Fixes #133
Fixes #139
Fixes #211
Fixes #240
Fixes #83
Fixes #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatters Related to parsing and formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@svenjacobs @kevincianfarini @dkhalanskyjb and others