-
-
Notifications
You must be signed in to change notification settings - Fork 415
Open
Description
- 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: Tested on Ubuntu 20.04 and Windows 10 with same results
- Pendulum version: 2.1.2
Issue
The DateTime.weekday() function does not return values consistent with the weekday constants. Illustration below:
import pendulum
# create a test date (this date falls on a Sunday)
test_date = pendulum.DateTime(2021, 11, 7)
# confirm that this is indeed a Sunday:
print(f'{test_date:%A}')
# output >> Sunday
# check if pendulum thinks its a Sunday (this FAILS)
print(test_date.weekday() == pendulum.SUNDAY)
# output >> False
# for some reason, it thinks it's a Saturday
print(test_date.weekday() == pendulum.SATURDAY)
# output >> TrueI believe this is because .weekday() is inherited from datetime.datetime, which means the solution should either be:
- Create a
pendulum.DateTime.weekday()override function that simply returns the .day_of_week property - Add another set of constants like
DT_MONDAYwhich corresponds with thedatetime.datetimeweekdays
Metadata
Metadata
Assignees
Labels
No labels
