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

New holidays? #102

Open
8 of 9 tasks
tracykteal opened this issue Aug 24, 2024 · 4 comments
Open
8 of 9 tasks

New holidays? #102

tracykteal opened this issue Aug 24, 2024 · 4 comments

Comments

@tracykteal
Copy link

tracykteal commented Aug 24, 2024

I created a few new general holidays, but probably they're not all needed in this package. Here's a list of the ones I have. @DavisVaughan if you would like any of them as a PR, could you just check which ones, and I'll put them in? It's also fine if none of these are relevant. Thanks so much!

  • Easter Monday (Monday after Easter)
  • Maundy Thursday (Thursday before Easter)
  • Ascension Day (40 days after Easter, the 6th Thursday after Easter)
  • Whit Monday (51 days after Easter, the Monday after Pentecost, so )
  • Boxing day (Dec 26)
  • Epiphany (Jan 6)
  • Assumption of Mary (Aug 15)
  • All Saints Day (Nov 1)
  • Feast of the Immaculate Conception (Dec 8)
@DavisVaughan
Copy link
Owner

I somewhat remember there being an important reason to not include days-offset-from-easter style holidays, and I have this in a slack message too

i think i made a conscious decision not to include easter offset style holidays. i cant remember quite why but i somewhat remember that being important to not include in the package

But those other 4 look good to me!

@DavisVaughan
Copy link
Owner

Ah ok I'm remembering why this is

almanac/R/holidays.R

Lines 16 to 23 in 7b14f6e

#' Note that _relative_ holidays, such as New Year's Eve, which is 1 day before
#' New Year's Day, aren't pre-created in a way that allows you to define
#' observance rules for them that depend on the observance rules of the holiday
#' they are relative to. If you need to do this, you should start with the base
#' holiday, here [hol_new_years_day()], and use [hol_observe()] and
#' [hol_offset()] on that to generate a New Year's Eve holiday that matches
#' your required observance rules. See the examples of [hol_offset()] for more
#' information.

This is the key example of what that comment is trying to explain

almanac/R/rholiday.R

Lines 121 to 127 in 7b14f6e

#' # Boxing Day is the day after Christmas.
#' # If observed Christmas is a Friday, then observed Boxing Day should be Monday.
#' # If observed Christmas is a Monday, then observed Boxing Day should be Tuesday.
#' on_boxing_day <- on_christmas %>%
#' hol_offset(1) %>%
#' hol_observe(on_weekends, adj_following) %>%
#' hol_rename("Boxing Day")

For things like Boxing Day, it gets "observed" by the general public relative to what happens on Christmas.

Consider the following scenario:

  • Christmas falls on a Sunday
  • The world observes it on a Monday
  • Even though Boxing Day's rule is "1 day after Christmas", which should put it on Monday, we actually observe it on Tuesday due to Christmas itself being observed on Monday

That's why we don't naively wrap up Boxing Day as a pre generated holiday. If we do that, we can't create offset rules correctly because we don't have access to that base holiday (Christmas, here) anymore

@DavisVaughan
Copy link
Owner

DavisVaughan commented Sep 13, 2024

Oh, actually, a closer read of my comment there shows that I'm just warning users that using the pre-created relative holidays that almanac provides won't do "the right thing" when adding observance rules on top of them, but I still provide them, like hol_christmas_eve() and hol_good_friday().

So I take back what I said, I think adding the ones relative to Easter and Christmas are fine too!

@tracykteal
Copy link
Author

Thanks! I see what you mean about getting the correct observing days when that depends on the observing of the base holiday.

For the Boxing Day example, hol_offset() would work correctly for Christmas, but not always for Boxing Day, if Christmas was on a Saturday or Sunday.

I think all the other ones are ok, because they're either always on the same day of the week (the Easter ones, since Easter is always on a Sunday), or they're standalone holidays, and their observed date doesn't depend on when another holiday is observed.

So, I'll add them all except for Boxing day, and that can be handled separately, if or how you want to add it.

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

2 participants