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

Day of week constants #819

Open
2 tasks done
DanCardin opened this issue Apr 22, 2024 · 0 comments
Open
2 tasks done

Day of week constants #819

DanCardin opened this issue Apr 22, 2024 · 0 comments

Comments

@DanCardin
Copy link

DanCardin commented Apr 22, 2024

  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.

In pendulum version 2.1.2 the day of week constants are defined as:

SUNDAY = 0
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
THURSDAY = 4
FRIDAY = 5
SATURDAY = 6

In version 3 they're defined as:

class WeekDay(IntEnum):
    MONDAY = 0
    TUESDAY = 1
    WEDNESDAY = 2
    THURSDAY = 3
    FRIDAY = 4
    SATURDAY = 5
    SUNDAY = 6

MONDAY = WeekDay.MONDAY
TUESDAY = WeekDay.TUESDAY
WEDNESDAY = WeekDay.WEDNESDAY
THURSDAY = WeekDay.THURSDAY
FRIDAY = WeekDay.FRIDAY
SATURDAY = WeekDay.SATURDAY
SUNDAY = WeekDay.SUNDAY

Further, this translates into object-API level differences:
2.1.2

>>> imp.today().weekday()
0
>>> pendulum.today().day_of_week
1

vs 3.0.0

>>> pendulum.today().weekday()
0
>>> pendulum.today().day_of_week
<WeekDay.MONDAY: 0>

At the very least, this appears to be an undocumented breaking change, if it's otherwise an intended change in API.

but it would be nice for there to be a baked-in part of the API to obtain the original 0=sunday day-of-week integer mapping. That somewhat relates to #63. Except I'm more just looking to retain the original pendulum integer mapping that appears to have changed.

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