18F/us-federal-holidays

Implementation does not match Federal Reserve Holiday Schedule

createthis opened this issue · 7 comments

Hello,

I was reviewing this excellent library with my team today when one of us noticed that the Saturday/Sunday policy of this library matches observed US Federal Holiday practices, but not US Federal Reserve Holiday practices.

For the former (this is the current behavior of this library): https://www.redcort.com/us-federal-bank-holidays/

  • When a federal holiday falls on a Saturday, it is usually observed on the preceding Friday. When the holiday falls on a Sunday, it is usually observed on the following Monday.

For the latter (library does not match this behavior): https://www.frbservices.org/about/holiday-schedules/index.html

*For holidays falling on Saturday, Federal Reserve Banks and Branches will be open the preceding Friday. For holidays falling on Sunday, all Federal Reserve Banks and Branches will be closed the following Monday.

The next such case is Friday, July 3rd 2020:

fedHolidays.isAHoliday(new Date('2020-07-03 00:00:00'))

This currently returns true, though from a "Is the Federal Reserve Open" perspective, it should be false.

I think both of these are probably useful interpretations to different users. Would you entertain an option to use this library in federal reserve mode?

@mgwalker see PR. Also, I strongly suggest a unit testing framework in the future. This was quite buggy.

For sure, some tests would be awesome. I'll open an issue for that and mark it with the help wanted label. Unfortunately I don't have a lot of spare time right now, but it'd be good to keep a reminder for myself in the future and also signal that we'd be happy to accept help from someone else.

Thanks!

@mgwalker I'll rework the PR to address the issues you raised. My work day is over, but I'll take a look first thing tomorrow if time allows.

@mgwalker take another look.

@mgwalker still around?

@createthis Hey there, sorry for the silence. I was on vacation and then a week out of town at training. Will take a look today!