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
Try running this code. You will notice that week_of_month returns negative values.
week_of_month
import pendulum from datetime import datetime problematic_dates = ['2021-01-30 00:00:00', '2021-01-29 00:00:00', '2021-01-28 00:00:00', '2021-01-27 00:00:00', '2021-01-26 00:00:00', '2021-01-25 00:00:00', '2021-01-23 00:00:00', '2021-01-22 00:00:00', '2021-01-21 00:00:00', '2021-01-20 00:00:00', '2021-01-19 00:00:00', '2021-01-18 00:00:00', '2021-01-15 00:00:00', '2021-01-14 00:00:00', '2021-01-13 00:00:00', '2021-01-12 00:00:00', '2021-01-11 00:00:00', '2021-01-09 00:00:00', '2021-01-08 00:00:00', '2021-01-07 00:00:00', '2021-01-06 00:00:00', '2021-01-05 00:00:00', '2021-01-04 00:00:00', '2019-12-31 00:00:00', '2019-12-30 00:00:00'] for x in problematic_dates: x = datetime.strptime(x, '%Y-%m-%d %H:%M:%S') week_num_of_the_month = pendulum.parse((x.strftime('%Y') + x.strftime('%m') + x.strftime('%d'))).week_of_month print(f'{x}: {week_num_of_the_month}')
OUTPUT:
2021-01-30 00:00:00: -48 2021-01-29 00:00:00: -48 2021-01-28 00:00:00: -48 2021-01-27 00:00:00: -48 2021-01-26 00:00:00: -48 2021-01-25 00:00:00: -48 2021-01-23 00:00:00: -49 2021-01-22 00:00:00: -49 2021-01-21 00:00:00: -49 2021-01-20 00:00:00: -49 2021-01-19 00:00:00: -49 2021-01-18 00:00:00: -49 2021-01-15 00:00:00: -50 2021-01-14 00:00:00: -50 2021-01-13 00:00:00: -50 2021-01-12 00:00:00: -50 2021-01-11 00:00:00: -50 2021-01-09 00:00:00: -51 2021-01-08 00:00:00: -51 2021-01-07 00:00:00: -51 2021-01-06 00:00:00: -51 2021-01-05 00:00:00: -51 2021-01-04 00:00:00: -51 2019-12-31 00:00:00: -46 2019-12-30 00:00:00: -46
The text was updated successfully, but these errors were encountered:
Fix behavior of the week_of_month property
84497bb
Fixes #438 Fixes #455 Fixes #536 Fixes #587 Fixes #598 Fixes #718
Fix behavior of the week_of_month property (#774)
c811ecd
Successfully merging a pull request may close this issue.
Issue
Try running this code. You will notice that
week_of_month
returns negative values.OUTPUT:
The text was updated successfully, but these errors were encountered: