Skip to content

Replace nil-returning year-gate functions with year_ranges#331

Merged
ppeble merged 1 commit into
holidays:masterfrom
ppeble:issue-204-year-range-conversions
Apr 30, 2026
Merged

Replace nil-returning year-gate functions with year_ranges#331
ppeble merged 1 commit into
holidays:masterfrom
ppeble:issue-204-year-range-conversions

Conversation

@ppeble
Copy link
Copy Markdown
Member

@ppeble ppeble commented Apr 30, 2026

Summary

  • Converts all functions that returned nil purely as a year-range gate to use the year_ranges definition field instead
  • Simplifies or removes the affected custom methods now that the year logic lives in the definition
  • Adds boundary tests for every changed year range in both pl.yaml and au.yaml

Changes

pl.yaml

  • Removes pl_trzech_kroli and pl_trzech_kroli_informal functions; replaces with mday: 6 + year_ranges: from: 2011 / until: 2010

au.yaml

  • march_pub_hol_sa: adds year_ranges: from: 2006; simplifies function
  • may_pub_hol_sa: adds year_ranges: until: 2005; simplifies function
  • qld_queens_birthday_june: adds year_ranges: until: 2015; simplifies function
  • qld_labour_day_may: splits into two definitions (until: 2012, from: 2016); simplifies function
  • qld_labour_day_october: adds year_ranges: between: {start: 2013, end: 2015}; simplifies function
  • qld_queens_bday_october: splits into mday: 1 + limited: [2012] and function + between: {start: 2016, end: 2022}; simplifies function
  • qld_kings_bday_october: already had year_ranges: from: 2023; drops nil branch from function
  • g20_day_2014_only: removes function entirely; replaces with mday: 14 + limited: [2014]

What was not changed

Functions where nil is a legitimate computation result (not a year gate) are left as-is: jp_citizens_holiday, jp_substitute_holiday, us_inauguration_day, even_year_election_day.

Test plan

  • All existing tests pass
  • New boundary tests added for every changed year range

Signed-off-by: Phil Peble <phil@peble.net>
@ppeble ppeble force-pushed the issue-204-year-range-conversions branch from 5d9a5b3 to 7634231 Compare April 30, 2026 04:32
@ppeble
Copy link
Copy Markdown
Member Author

ppeble commented Apr 30, 2026

This is as no-op and simplify codifies existing behavior. For this reason I am not waiting for additional approval.

@ppeble ppeble merged commit 644ad6c into holidays:master Apr 30, 2026
9 checks passed
@ppeble ppeble deleted the issue-204-year-range-conversions branch April 30, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant