Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a Struct or Structs for the holiday definition map #2

Open
CoderDennis opened this issue Aug 14, 2016 · 0 comments
Open

Use a Struct or Structs for the holiday definition map #2

CoderDennis opened this issue Aug 14, 2016 · 0 comments

Comments

@CoderDennis
Copy link
Owner

CoderDennis commented Aug 14, 2016

As it stands, the map defining each holiday doesn't have any constraints on what fields it contains.

I think this will be done with structs, but I haven't worked with them much yet.

There are 3 different kinds of holiday definitions. Does that mean 3 different Struct types?

  1. static holidays fall on a given day and month every year. eg. New Year's Day is always January 1st.
  2. nth holidays fall on the nth weekday of a given month. eg. Memorial Day in the US is on the last Monday in May.
  3. function holidays use a function to determine their date. The function typically has year as its parameter. The definition of a function is given as a tuple {ModuleName, :functionName, [params]}. Easter Sunday is the best example. There can also be a 4th element of the tuple, which is an integer representing how many days to add (or subtract via negative number) to the date returned by the function. For Good Friday we use the :easter function and subtract 2 days.
@CoderDennis CoderDennis changed the title Provide some kind of spec or template for the holiday definition map Use a Struct or Structs for the holiday definition map Jan 9, 2022
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

No branches or pull requests

1 participant