Skip to content

Conversation

@voughtdq
Copy link

I wanted to be able to use the definitions repository directly. This way, it's simply a matter of updating the dep entry in mix.exs. All changes are backwards compatible and these changes are opt-in only. All modifications were made under the provided nix flake environment.

  • Wrap year ranges
    • in_year_ranges?/2 was failing because it expects a list for the first argument, but some rules produce a map instead of a list.
  • Add missing in_year_range/2 clauses
  • Use deps to get holiday definition files
  • Add missing date functions
    • For Holidefs.Definition.CustomFunctions:
      • Add orthodox_easter_julian/2 as an alias
      • Add Rosh Hashanah dates up to 2052
      • Add Yom Kippur dates up to 2052
      • Add Matariki dates up to 2052
      • Add epiphany/2
      • Add to_near_monday_after/2
      • Add qld_brisbane_ekka_holiday/2
      • Add qld_kings_bday_october/2
      • Add ch_be_zibelemaerit/2
      • Add saint_josephs_day/2
      • Add saint_peter_and_saint_paul/2
      • Add assumption_of_mary/2
      • Add columbus_day/2
      • Add all_saints_day/2
      • Add independence_of_cartagena/2
      • Add co_shift_date/3 to assist other functions
    • For Holidefs.DateCalculator:
      • Add to_nearest_monday_after/1
  • Add custom exceptions
  • Refactor build/3 and supporting functions
    • Some rules failed to build because their maps didn't match the clauses in build/3.
    • Added week!/1 for validating weeks
    • Added weekday!/1 for validating weekdays as well as converting Ruby's Sunday value (0) to Elixir's Sunday value (7) so that manual edits of the definition files are no longer necessary
    • Changed function_from_name/1 to function_from_name!/1 and raise a FunctionNotDefinedError when the function isn't available
    • Added fall-through cases for function_from_name!/1
    • Tests check for the new exceptions and verify the Ruby week day gets converted properly
  • Add the ability supply a :deps argument to load!/3
    • When :deps is supplied in the third argument, we use the holiday definitions from the deps path instead of the priv directory.
  • Format and apply credo suggestions

voughtdq added 8 commits July 11, 2024 01:59
in_year_ranges?/2 was failing because it expects a list for the first
argument, but some rules produce a map instead of a list.
For Holidefs.Definition.CustomFunctions:
 - Add orthodox_easter_julian/2 as an alias
 - Add Rosh Hashanah dates up to 2052
 - Add Yom Kippur dates up to 2052
 - Add Matariki dates up to 2052
 - Add epiphany/2
 - Add to_near_monday_after/2
 - Add qld_brisbane_ekka_holiday/2
 - Add qld_kings_bday_october/2
 - Add ch_be_zibelemaerit/2
 - Add saint_josephs_day/2
 - Add saint_peter_and_saint_paul/2
 - Add assumption_of_mary/2
 - Add columbus_day/2
 - Add all_saints_day/2
 - Add independence_of_cartagena/2
 - Add co_shift_date/3 to assist other functions

 For Holidefs.DateCalculator:
  - Add to_nearest_monday_after/1
Some rules failed to build because their maps didn't match the clauses
in build/3.
 - Added week!/1 for validating weeks
 - Added weekday!/1 for validating weekdays as well as converting
   Ruby's Sunday value (0) to Elixir's Sunday value (7) so that manual
   edits of the definition files are no longer necessary
 - Changed function_from_name/1 to function_from_name!/1 and raise a
   FunctionNotDefinedError when the function isn't available
 - Added fall-through cases for function_from_name!/1
 - Tests check for the new exceptions and verify the Ruby week day
   gets converted properly
When :deps is supplied in the third argument, we use the holiday
definitions from the deps path instead of the priv directory.
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