Open
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
The Problem
There is this inconsistency that makes the idea of constructing a Day
enum from an integer somewhat problematic, and it makes passing these integers confusing to pass around since it depends where it came from.
from datetime import datetime
import pendulum
# when ran on wednesday
datetime.now().weekday() # 2
pendulum.now().weekday() # 2
pendulum.now().day_of_week # 3
Proposed Solution
It would be nice if pendulum had a Day
enum and it returned that enum for day_of_week
. The underlying number could be left consistent with python's integer values this way, and allow for API usage such as:
from pendulum import Day
# using Day enum with a pendulum instance
pendulum.now() == Day.WEDNESDAY
pendulum.now() == Day.WED
pendulum.now().previous(Day.WED)
# constructing a Day
Day(datetime.now())
Day(datetime.now().weekday())
Day("wednesday")
# optionally add methods to Day instance
pendulum.now().day_of_week.is_wednesday()