Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for tz-aware datetime.datetime objects
## Original issue ## Issue: python-telegram-bot#1409 version: 12.0.0b1 ## Changes ## The `._put()` method can now accept utc_offset-aware/timezone-aware `datetime.datetime` objects. This helps bots to be hosted on a server with any timezone without complications. To convert datetimes to UTC, a "UTC" subclass of the `datetime.tzinfo` class was added, and used in `._put()`. ## Other options considered ## - Changing all the `.now()` comparisons in `._put()` to `.utcnow()`. This was not chosen, since it would cause a major compatibility issue. Bots would have to be rewritten to pass in UTC datetimes, instead of local (computer time) datetimes, into the jobqueue.run_once and other methods. This would likely be unwanted behaivour.
- Loading branch information