feat: Implement LocalDate
, OffsetDate
and DateInterval
#252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I started out with the aim of porting missing tests and functionality for
LocalDate
, one thing led to another and...I ended up fleshing out
DateInterval
and addingOffsetDate
as well.Noda Time provides
LocalDate
conversion methods to/from the BCLDateTime
. Over in #160, I discussed how these might look in python.Having thought about it some more, I don't think it makes sense to port those. The reason they exist in Noda Time has a lot to do with .NET not having a discrete date-only type until fairly recently. The existing conversions to/from
datetime.date
make more sense, and mirror the newer conversion methods to/fromDateOnly
in Noda Time. It's easier to add these later than it would be to remove them.I believe this is the first time I've encountered a Noda Time type (
DateInterval
) which implements bothDeconstruct
andGetEnumerator
, but I could be wrong. At any rate, I came to the conclusion in #248 that__iter__()
in Pyoda Time should be reserved forGetEnumerator
ports. It's probably more valuable than a deconstructor, which from one point of view is syntactic sugar for assignment which is easily achieved in Python in a more explicit way. Just need to revisit previously-ported classes at some point and make sure the project is consistent about that.Related to:
Deconstruct
/GetEnumerator
to Python #248