svpino / rfeed

Extensible RSS 2.0 Feed Generator written in Python
MIT License
185 stars 41 forks source link

date doesn't support timezones #22

Open alien8ion opened 2 years ago

alien8ion commented 2 years ago

Serializable._date() returns a date string with a hard-coded 'GMT' timezone representation regardless of the actual timezone of the datetime object.

Neither the RSS 2.0 Specification nor the RFC 2822 (section 5.1 SYNTAX) require a GMT/UTC value for the datetime, just that it follow the specified format.

I would suggest that instead of blindly returning 'GMT' for the timezone, either use the tzname() of the timezone aware datetime object and default to 'UTC' if it returns None, or convert any timezone aware datetime objects to UTC and then return the new value + 'UTC' as the timezone value.