77 *
88 * The easy PHP Library for calculating holidays.
99 *
10- * Copyright (c) 2025 Magic Web Group
10+ * Copyright (c) 2015 - 2025 AzuyaLabs
1111 *
1212 * For the full copyright and license information, please view the LICENSE
1313 * file that was distributed with this source code.
1414 *
15+ * @author Sacha Telgenhof <me at sachatelgenhof dot com>
1516 * @author Art Kurbakov <admin at mgwebgroup dot com>
1617 */
1718
18- // This file in addition to regular holidays observed by US stock exchanges,
19+ // This file in addition to regular holidays observed by
20+ // the New York Stock Exchange (NYSE),
1921// includes full day special closure events due to:
2022// weather, national emergencies and presidential proclamations.
2123// All closure events are included from year 2000.
2224
2325namespace Yasumi \Provider \USA ;
2426
25- use Yasumi \Provider \USA ;
2627use Yasumi \Holiday ;
27- use DateTime ;
28- use DateTimeZone ;
28+ use Yasumi \Provider \USA ;
2929
3030class NYSE extends USA
3131{
@@ -36,68 +36,72 @@ class NYSE extends USA
3636 */
3737 public function initialize (): void
3838 {
39- $ this ->timezone = 'America/New_York ' ;
39+ $ this ->timezone = 'America/New_York ' ;
4040
41- // Add exhange-specific holidays
41+ // Add exhange-specific holidays
4242 $ this ->addHoliday ($ this ->newYearsDay ($ this ->year , $ this ->timezone , $ this ->locale ));
4343 $ this ->calculateMartinLutherKingday ();
4444 $ this ->calculateWashingtonsBirthday ();
4545 $ this ->addHoliday ($ this ->goodFriday ($ this ->year , $ this ->timezone , $ this ->locale ));
4646 $ this ->calculateMemorialDay ();
47- if (2021 < $ this ->year )
48- $ this ->calculateJuneteenth ();
47+ if (2021 < $ this ->year ) {
48+ $ this ->calculateJuneteenth ();
49+ }
4950 $ this ->calculateIndependenceDay ();
5051 $ this ->calculateLabourDay ();
5152 $ this ->calculateThanksgivingDay ();
5253 $ this ->addHoliday ($ this ->christmasDay ($ this ->year , $ this ->timezone , $ this ->locale ));
5354
5455 $ this ->calculateSubstituteHolidays ();
55-
56- // Add other full-day closure events
57- $ this ->addWeatherEvents ();
58- $ this ->addEmergencies ();
59- $ this ->addProclamations ();
60- }
61-
62- private function addWeatherEvents ()
63- {
64- if (2012 == $ this ->year ) {
65- $ this ->addHoliday (new Holiday ('hurricaneSandy1 ' , [], new DateTime ('2012-10-29 ' , new DateTimeZone ($ this ->timezone ))));
66- $ this ->addHoliday (new Holiday ('hurricaneSandy2 ' , [], new DateTime ('2012-10-30 ' , new DateTimeZone ($ this ->timezone ))));
67- }
68- }
69-
70- private function addEmergencies ()
71- {
72- if (2001 == $ this ->year ) {
73- $ this ->addHoliday (new Holiday ('groundZero1 ' , [], new DateTime ('2001-09-11 ' , new DateTimeZone ($ this ->timezone ))));
74- $ this ->addHoliday (new Holiday ('groundZero2 ' , [], new DateTime ('2001-09-12 ' , new DateTimeZone ($ this ->timezone ))));
75- $ this ->addHoliday (new Holiday ('groundZero3 ' , [], new DateTime ('2001-09-13 ' , new DateTimeZone ($ this ->timezone ))));
76- $ this ->addHoliday (new Holiday ('groundZero4 ' , [], new DateTime ('2001-09-14 ' , new DateTimeZone ($ this ->timezone ))));
77- }
78- }
7956
80- private function addProclamations ()
81- {
82- if (2004 == $ this ->year )
83- $ this ->addHoliday (new Holiday ('ReaganMourning ' , [], new DateTime ('2004-06-11 ' , new DateTimeZone ($ this ->timezone ))));
84- if (2007 == $ this ->year )
85- $ this ->addHoliday (new Holiday ('GRFordMourning ' , [], new DateTime ('2007-01-02 ' , new DateTimeZone ($ this ->timezone ))));
86- if (2018 == $ this ->year )
87- $ this ->addHoliday (new Holiday ('HWBushMourning ' , [], new DateTime ('2018-12-05 ' , new DateTimeZone ($ this ->timezone ))));
88- if (2025 == $ this ->year )
89- $ this ->addHoliday (new Holiday ('CarterMourning ' , [], new DateTime ('2025-01-09 ' , new DateTimeZone ($ this ->timezone ))));
90- }
57+ // Add other full-day closure events
58+ $ this ->addWeatherEvents ();
59+ $ this ->addEmergencies ();
60+ $ this ->addProclamations ();
61+ }
9162
9263 public function getSources (): array
9364 {
9465 return [
95- 'https://www.nyse.com/trader-update/history#11507 ' ,
96- 'https://s3.amazonaws.com/armstrongeconomics-wp/2013/07/NYSE-Closings.pdf ' ,
97- 'https://ir.theice.com/press/news-details/2018/New-York-Stock-Exchange-to-Honor-President-George-H-W-Bush/default.aspx ' ,
98- 'https://ir.theice.com/press/news-details/2024/The-New-York-Stock-Exchange-Will-Close-Markets-on-January-9-to-Honor-the-Passing-of-Former-President-Jimmy-Carter-on-National-Day-of-Mourning/default.aspx ' ,
99- 'https://www.thecorporatecounsel.net/blog/2021/10/nyse-makes-juneteenth-a-new-market-holiday.html ' ,
66+ 'https://www.nyse.com/trader-update/history#11507 ' ,
67+ 'https://s3.amazonaws.com/armstrongeconomics-wp/2013/07/NYSE-Closings.pdf ' ,
68+ 'https://ir.theice.com/press/news-details/2018/New-York-Stock-Exchange-to-Honor-President-George-H-W-Bush/default.aspx ' ,
69+ 'https://ir.theice.com/press/news-details/2024/The-New-York-Stock-Exchange-Will-Close-Markets-on-January-9-to-Honor-the-Passing-of-Former-President-Jimmy-Carter-on-National-Day-of-Mourning/default.aspx ' ,
70+ 'https://www.thecorporatecounsel.net/blog/2021/10/nyse-makes-juneteenth-a-new-market-holiday.html ' ,
10071 ];
10172 }
102- }
10373
74+ private function addWeatherEvents ()
75+ {
76+ if (2012 == $ this ->year ) {
77+ $ this ->addHoliday (new Holiday ('hurricaneSandy1 ' , [], new \DateTime ('2012-10-29 ' , new \DateTimeZone ($ this ->timezone ))));
78+ $ this ->addHoliday (new Holiday ('hurricaneSandy2 ' , [], new \DateTime ('2012-10-30 ' , new \DateTimeZone ($ this ->timezone ))));
79+ }
80+ }
81+
82+ private function addEmergencies ()
83+ {
84+ if (2001 == $ this ->year ) {
85+ $ this ->addHoliday (new Holiday ('groundZero1 ' , [], new \DateTime ('2001-09-11 ' , new \DateTimeZone ($ this ->timezone ))));
86+ $ this ->addHoliday (new Holiday ('groundZero2 ' , [], new \DateTime ('2001-09-12 ' , new \DateTimeZone ($ this ->timezone ))));
87+ $ this ->addHoliday (new Holiday ('groundZero3 ' , [], new \DateTime ('2001-09-13 ' , new \DateTimeZone ($ this ->timezone ))));
88+ $ this ->addHoliday (new Holiday ('groundZero4 ' , [], new \DateTime ('2001-09-14 ' , new \DateTimeZone ($ this ->timezone ))));
89+ }
90+ }
91+
92+ private function addProclamations ()
93+ {
94+ if (2004 == $ this ->year ) {
95+ $ this ->addHoliday (new Holiday ('ReaganMourning ' , [], new \DateTime ('2004-06-11 ' , new \DateTimeZone ($ this ->timezone ))));
96+ }
97+ if (2007 == $ this ->year ) {
98+ $ this ->addHoliday (new Holiday ('GRFordMourning ' , [], new \DateTime ('2007-01-02 ' , new \DateTimeZone ($ this ->timezone ))));
99+ }
100+ if (2018 == $ this ->year ) {
101+ $ this ->addHoliday (new Holiday ('HWBushMourning ' , [], new \DateTime ('2018-12-05 ' , new \DateTimeZone ($ this ->timezone ))));
102+ }
103+ if (2025 == $ this ->year ) {
104+ $ this ->addHoliday (new Holiday ('CarterMourning ' , [], new \DateTime ('2025-01-09 ' , new \DateTimeZone ($ this ->timezone ))));
105+ }
106+ }
107+ }
0 commit comments