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

week_of_month in pendulum_parse for Timestamp '2021-01-15 14:00:00' returns -50 #587

Closed
vidyasagar86 opened this issue Dec 10, 2021 · 3 comments · Fixed by #774
Closed
Labels

Comments

@vidyasagar86
Copy link

vidyasagar86 commented Dec 10, 2021

week_of_month in pendulum_parse for Timestamp '2021-01-15 14:00:00' returns -50

Sample code:
import pendulum

x='2021-01-15 14:00:00'
dt=pendulum.parse(x)
print(dt.week_of_month)

Output result -50

@anvit25
Copy link

anvit25 commented Dec 10, 2021

I looked a bit into it. Seems like Jan 1 2021 is defined as 5th weekday of the 53rd week of 2020. And this is a "problem" with the datetime module.

@dmateusp
Copy link

dmateusp commented Jan 2, 2023

This is an issue in 2023 as well

>>> pendulum.instance(datetime(2023, 1, 2, 0, 0)).week_of_month
-50

using pendulum==2.1.2

This library is used in Airflow so I imagine more people will encounter it

@pylead
Copy link

pylead commented May 12, 2023

Using pendulum==2.1.2 confirm, the issue presents.

>>> import pendulum
>>> pendulum.DateTime(2023, 1, 2).week_of_month
-50

sdispater added a commit that referenced this issue Dec 14, 2023
sdispater added a commit that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants