python-redmine icon indicating copy to clipboard operation
python-redmine copied to clipboard

the updated_on value is missing the tzinfo (naive datetime object)

Open dpocock opened this issue 3 years ago • 1 comments

tested with the Debian package version 2.2.1-1 and Redmine 3.3.1-4+deb9u2, PostgreSQL backend

Here is the workaround I'm using in my code:

            # FIXME - why doesn't this already have tzinfo from the API?
            last_modified = issue['updated_on']
            if last_modified.tzinfo is None:
                app.logger.debug("ticket #%s: Redmine API updated_on value has no timezone, assuming UTC" % (issue['id'],))
                last_modified = last_modified.replace(tzinfo=datetime.timezone.utc)
            todo['last-modified'] = icalendar.vDatetime(last_modified)

dpocock avatar Mar 18 '21 16:03 dpocock

That can be a nice feature to add, thanks for the idea.

maxtepkeev avatar Apr 12 '21 15:04 maxtepkeev

Implemented in 517af437886beae1fa47eea8b6aa1a5b18f21551. Will be released in next version. Once again thanks for the idea.

maxtepkeev avatar Jan 05 '23 20:01 maxtepkeev