Add support for WEEK/DAY period #979
Closed
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.
New features
This is a test-driven attempt to capitalise on #966 from @nikhilwoodruff, to add support for weeks in OpenFisca.
The main difference is that this draft makes a distinction between
days
andweekdays
.In doing so, we can treat both ISO dates and ISO week dates interchangeably.
Scope is yet more limited than your examples @nikhilwoodruff.
My idea would be to rely on
Instant
for values, and let Period handle both date types,2014-01-03
and2014-W3-1
.We could either let the parser do that with the actual
type
string, or separate the two periods in different classes and letPeriod
orchestrate/dispatch between the two as needed.Yes, as long as we identify common years of 52W or leap years of 53W, or that we use the average of ~52.2 weeks per year.
TBD
TBD
Comments? @sandcha @guillett @Morendil @Br3nda @sarafalamaki @benjello et al.