Skip to content
New issue

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

Increase DateTime by 1 day across daylight saving change point fails #768

Closed
2 tasks done
0liu opened this issue Nov 8, 2023 · 0 comments · Fixed by #775
Closed
2 tasks done

Increase DateTime by 1 day across daylight saving change point fails #768

0liu opened this issue Nov 8, 2023 · 0 comments · Fixed by #775

Comments

@0liu
Copy link

0liu commented Nov 8, 2023

  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: Manjaro Linux 6.6.0
  • Pendulum version: 2.1.2

Issue

>>> import pendulum; pendulum.datetime(2023,11,5,0,0,tz='America/Chicago') + pendulum.duration(days=1)
DateTime(2023, 11, 5, 23, 0, 0, tzinfo=Timezone('America/Chicago'))

The result should be DateTime(2023, 11, 6, 0, 0, 0, tzinfo=Timezone('America/Chicago')). A workaround is using the traditional datetime library as the base datetime:

>>> start = pendulum.datetime(2023,11,5,0,0,tz='America/Chicago')
>>> import datetime
>>> pendulum.instance(datetime.datetime.fromtimestamp(start.timestamp(), tz=start.tzinfo) + pendulum.duration(days=1))
DateTime(2023, 11, 6, 0, 0, 0, tzinfo=Timezone('America/Chicago'))

This bug made my customized Airflow time schedule failed yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant