azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.05k stars 155 forks source link

Added provider class with New York Stock Exchange holidays. Added test cases. #35

Closed mgwebgroup closed 6 years ago

mgwebgroup commented 8 years ago

Added class NYSE.php to the Provider directory. The class uses holidays observed by the New York Stock Exchange published on https://www.nyse.com/markets/hours-calendars

Added test classes 'tests/GoodFridayTest.php' and 'tests/NYSETest.php'

stelgenhof commented 8 years ago

Thanks for the PR! Let me have a look at it this coming weekend.

stelgenhof commented 8 years ago

Hi @mgwebgroup ,

I had a look at your PR and am not sure if this would be the right approach. NYSE wouldn't be a 'real' country/subregion since your class merely is a subset of the USA Holiday provider. I think a better approach would be to create it as a filter.

Cheers! Sacha

mgwebgroup commented 8 years ago

Allright, I'll see what I can do. Do you have a preference for a filter name?

stelgenhof commented 8 years ago

The filter name can be anything, as long as it is clear :) It would be very easy to implement: just check the dates that are considered part of the NYSE calendar in the 'accept' method of the filter.

The only small catch is that this filter will only work with the USA Holiday provider.

mgwebgroup commented 8 years ago

I'll see what I can do. Thanks for the suggestion. I will be able to look into this after September 1st.

stelgenhof commented 8 years ago

Sure no problem!

stelgenhof commented 6 years ago

I have added a recipe how you can easily extend an existing holiday provider to create your own custom provider: https://azuyalabs.github.io/yasumi/cookbook/custom_provider

Note: you need to use the latest v1.8.0 release for this to work :)