simon-weber / python-libfaketime

A fast time mocking alternative to freezegun that wraps libfaketime.
GNU General Public License v2.0
73 stars 15 forks source link

Support zoneinfo #84

Open ruudvandenboomen opened 2 months ago

ruudvandenboomen commented 2 months ago

Currently pytz is used to make datetimes timezone aware. It would be great if support for zoneinfo would be built as this is now part of the Python standard library.

simon-weber commented 2 months ago

What kind of changes would this require? Or do you have an example of what doesn't work?

ruudvandenboomen commented 2 months ago

@simon-weber instead of calling pytz.timezone("Europe/Amsterdam").localize(datetime_obj) you should call datetime_obj.replace(tzinfo=zoneinfo.ZoneInfo("Europe/Amsterdam")) so it's fairly simple