I have a problem with that the offset gets wrong when working with timezones.
Below is a snippet that shows the problem, there is a date which is considered to be CEST and thus have an offset of 2 hours. When printing this I get the offset of 1 hour.
In : tz_sthlm.localize(datetime.datetime.strptime('2017-05-01', '%Y-%m-%d')) Out: datetime.datetime(2017, 5, 1, 0, 0, tzinfo=<DstTzInfo 'Europe/Stockholm' CEST+2:00:00 DST>)
In : rfc3339.format(tz_sthlm.localize(datetime.datetime.strptime('2017-05-01', '%Y-%m-%d'))) Out: '2017-05-01T00:00:00+01:00'
I looked into the code and found
rfc3339.py (row 79) return _timedelta_to_seconds(date.dst() or date.utcoffset())
Where the utc delta, is the value of the daylight savings adjustment and not the actual utc offset.
Might work better I think?
I might be able to supply a fix for this.