Current State
Currently, there are 3 ways to index Weekday objects. iso and index both offer number Monday to Sunday 1..7 and us numbers Sunday to Saturday 0..6.
Proposal
I propose that index should number Monday to Sunday using 0..6, which would be different to the other two ways. This has the following advantage: Most cultures consider Monday the first day of the week and for mathematical reasons it is convenient to be able to access a first day of the week using the 0th index (like for us, the first day index is also 0).
While this is a breaking change, it does not influence the semantics of iso and us, which are presumably used by most people for accessing a weekday index for clarity, as suggested in the documentation.
Current Workaround
Either subtract 1 from the index on every operation or implement an extension type that uses an additional index implementation.
Somewhat related
On that note, it would also be nice to add dedicated methods for parsing Weekdays and a getter for accessing two-letter weekday shorthands. Those are minor quality of life features and unrelated to the actual proposal. I would be happy to contribute them if you deem them in the scope of the package though!
Current State
Currently, there are 3 ways to index
Weekdayobjects.isoandindexboth offer number Monday to Sunday 1..7 andusnumbers Sunday to Saturday 0..6.Proposal
I propose that
indexshould number Monday to Sunday using 0..6, which would be different to the other two ways. This has the following advantage: Most cultures consider Monday the first day of the week and for mathematical reasons it is convenient to be able to access a first day of the week using the 0th index (like forus, the first day index is also 0).While this is a breaking change, it does not influence the semantics of
isoandus, which are presumably used by most people for accessing a weekday index for clarity, as suggested in the documentation.Current Workaround
Either subtract 1 from the
indexon every operation or implement an extension type that uses an additional index implementation.Somewhat related
On that note, it would also be nice to add dedicated methods for parsing
Weekdays and a getter for accessing two-letter weekday shorthands. Those are minor quality of life features and unrelated to the actual proposal. I would be happy to contribute them if you deem them in the scope of the package though!