We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datetime_to_fakedatetime
fold
since python 3.6 version to datetime class was added fold argument to disambiguate the times during a repeated interval.
An example of where it can hurt :
from datetime import timezone, datetime from freezegun import api d = datetime(2021, 10, 30, 23, tzinfo=timezone.utc) fd = api.FakeDatetime(2021, 10, 30, 23, tzinfo=timezone.utc) isr = tz.gettz('Israel') d.astimezone(isr).dst() == fd.astimezone(isr).dst() >> False
The text was updated successfully, but these errors were encountered:
In real terms this is particularly frustrating because we can't test TZ changes in our code. This is one of the big use cases for us.
>>> from datetime import datetime >>> from zoneinfo import ZoneInfo >>> >>> from freezegun import freeze_time >>> >>> UTC = ZoneInfo("UTC") >>> UK = ZoneInfo("Europe/London") >>> >>> before_change = datetime(2023, 10, 29, 0, 30, tzinfo=UTC) >>> with freeze_time(before_change): ... print(before_change.astimezone(UK)) ... print(datetime.now(UTC).astimezone(UK)) ... 2023-10-29 01:30:00+01:00 2023-10-29 01:30:00+01:00 >>> after_change = datetime(2023, 10, 29, 1, 30, tzinfo=UTC) >>> with freeze_time(after_change): ... print(after_change.astimezone(UK)) ... print(datetime.now(UTC).astimezone(UK)) ... 2023-10-29 01:30:00+00:00 2023-10-29 01:30:00+01:00
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
since python 3.6 version to datetime class was added
fold
argument to disambiguate the times during a repeated interval.An example of where it can hurt :
The text was updated successfully, but these errors were encountered: