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 returns 6, although months can only have 5 weeks max #847

Open
2 tasks done
kaushalpartani opened this issue Sep 26, 2024 · 0 comments
Open
2 tasks done

Comments

@kaushalpartani
Copy link

  • I am on the latest Pendulum version.
    pendulum==3.0.0
  • I have searched the issues of this repo and believe that this is not a duplicate.
    There are no current open issues. The closest one I could find is one that was opened in 2020. Most of the issues with this property have to do with negative values; however this issue seems to be more about miscounting
  • OS version and name: MacOS Sequoia
  • Pendulum version: 3.0.0

Issue

Was playing around with the week_of_month property and found some interesting behavior:

The following:

err_dt = pendulum.datetime(2024, 9, 30, tz='America/Los_Angeles')
err_dt.week_of_month

Results in this output:

6

I'm a bit confused by this behavior and believe it should be a bug because September 2024 should have the following week breakdowns:

Week 1: September 1st, Sunday -> September 8th Sunday
Week 2: September 8th, Sunday -> September 15th Sunday
Week 3: September 15th Sunday -> September 22nd Sunday
Week 4: September 22nd Sunday -> September 29th Sunday
Week 5: September 29th Sunday -> September 30th Monday (last date in September)

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

No branches or pull requests

1 participant