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.
Currently dates in holiday definitions are given either by custom functions or strings like
on("01-02")
meaning month 1, day 2, i.e. 2nd of Januaryon("1. monday in August")
on("3 days before Easter")
on(self.saturday_after_10_31)
Those strings offer no code completion in the IDE and might be error prone (is 3rd of October "10-03" or "03-10"?). Having a DSL for this would help to define those as code, e.g
on(month=1, day=2)
on(first("monday").of("august"))
on(day(3).before(self.easter()))
Especially dates for which custom functions were required can then be defined simply by combining above features, e.g.
on(first("saturday").after(month=10, day=31))
This PR adds the functions laid out above and replaces all usages of date strings with the DSL.
Additionally, some refactoring was done to the core classes.