Skip to content

Conversation

@rypervenche
Copy link

Adding support for RFC2822 as per https://tools.ietf.org/html/rfc2822#section-3.3.

@zerodogg
Copy link

Useful. Sort of. I just implemented the exact same thing and was about to submit a pull request. Serves me right for not checking existing ones. Anyhoo, could this be merged? It's quite useful - in my case for parsing dates in RSS feeds.

@zerodogg
Copy link

@rypervenche your implementation breaks when DateTime::Timezones is in use.

[1 zerodogg@mal ~]+$ raku -MDateTime::Parse -e 'say DateTime::Parse.new("Tue, 08 Sep 2020 14:11:48 +0230")'                                                            
2020-09-08T14:11:48Z
[0 zerodogg@mal ~]+$ raku -MDateTime::Timezones -MDateTime::Parse -e 'say DateTime::Parse.new("Tue, 08 Sep 2020 14:11:48 +0230")'
This type cannot unbox to a native integer: P6opaque, Str
  in method <anon> at /var/home/zerodogg/.raku/sources/3B675F5F3A9B8F11C18AE4B193F9F53345002C31 (DateTime::Timezones) line 120
  in method rfc2822-date at /var/home/zerodogg/.raku/sources/703635D3023B1FE6D98BF2600452B9BCA55789BB (DateTime::Parse) line 173
  in regex rfc2822-date at /var/home/zerodogg/.raku/sources/703635D3023B1FE6D98BF2600452B9BCA55789BB (DateTime::Parse) line 70
  in regex TOP at /var/home/zerodogg/.raku/sources/703635D3023B1FE6D98BF2600452B9BCA55789BB (DateTime::Parse) line 8
  in method new at /var/home/zerodogg/.raku/sources/703635D3023B1FE6D98BF2600452B9BCA55789BB (DateTime::Parse) line 307
  in block <unit> at -e line 1

Using non-RFC2822 works, however:

[0 zerodogg@mal ~]+$ raku -MDateTime::Timezones -MDateTime::Parse -e 'say DateTime::Parse.new("Tue, 08 Sep 2020 14:11:48 GMT")' 
2020-09-08T14:11:48Z

@zerodogg
Copy link

@alabamenhu do you have any idea what is going on here -^ ?

@alabamenhu
Copy link

@alabamenhu do you have any idea what is going on here -^ ?

This should be resolved now with DateTime::Timezones:ver<0.3.2> More details in alabamenhu/DateTimeTimezones#2 . Let me know if it works okay and I'll package up a release too

@zerodogg
Copy link

@alabamenhu That fixed it, cheers!

@sergot
Copy link
Owner

sergot commented May 30, 2022

I've just merged some old PRs and I wanted to merge this, but there are conflicts, could you please take a look @rypervenche ?

@sergot
Copy link
Owner

sergot commented May 30, 2022

Or if you @zerodogg or @alabamenhu want to create a new PR for that, I'll be forever grateful :)

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.

4 participants