Definition Functions should return 'date' or 'integer' only
ppeble opened this issue · comments
There are some functions that I have found in various definitions that can return a 'nil' result, which apparently means that the date should not be added to the returned dates. I think that this is confusing and should be changed. We should institute a rule that all custom functions must return either:
- a modified 'date' that can be used
- an integer that represents a day (mday) that can be used to build a new date
Here is an example of what I mean: https://github.com/holidays/holidays/blob/master/lib/generated_definitions/pl.rb#L64-L75
In this case if the year is after 2010 then we return 'nil'. This is confusing to me. We could instead change the definition to use the new 'year_range' functionality.
Anyone else have any thoughts? If not I will go through and make these changes where I find them and make the change. And to be clear, this will not result in different output. This is an internal-only change and will only affect new definition functions.