view release on metacpan or search on metacpan
# SYNOPSIS
use Date::Holidays::NYSE qw{is_holiday};
my $holiday_name = is_holiday($year, $month, $day);
# DESCRIPTION
Date::Holidays Adapter for New York Stock Exchange (NYSE) holidays
Per https://www.nyse.com/markets/hours-calendars these are the NYSE holidays.
New Years Day (not observed on 12/31)
Martin Luther King, Jr. Day
Washington's Birthday
Good Friday (falls between March 20 and April 23)
Memorial Day
Juneteenth National Independence Day (first observed in 2022)
Independence Day
Labor Day
Thanksgiving Day
lib/Date/Holidays/NYSE.pm view on Meta::CPAN
=head1 SYNOPSIS
use Date::Holidays::NYSE qw{is_holiday};
my $holiday_name = is_holiday($year, $month, $day);
=head1 DESCRIPTION
Date::Holidays Adapter for New York Stock Exchange (NYSE) holidays
Per https://www.nyse.com/markets/hours-calendars these are the NYSE holidays.
New Years Day (not observed on 12/31)
Martin Luther King, Jr. Day
Washington's Birthday
Good Friday (falls between March 20 and April 23)
Memorial Day
Juneteenth National Independence Day (first observed in 2022)
Independence Day
Labor Day
Thanksgiving Day
lib/Date/Holidays/NYSE.pm view on Meta::CPAN
# Good Friday is the Friday before Easter Sunday.
# Easter can happen on any day from March 22 to April 25.
# thus Good Friday can happen on any day from March 20 to April 23.
my ($year_easter , $month_easter , $day_easter ) = Date::Calc::Easter_Sunday($year);
my ($year_good_friday, $month_good_friday, $day_good_friday) = Date::Calc::Add_Delta_Days($year_easter, $month_easter, $day_easter, -2);
if ($year == $year_good_friday and $month == $month_good_friday and $day == $day_good_friday) {
$is_good_friday = 1;
}
}
#Ref: https://www.nyse.com/markets/hours-calendars
#Ref: https://web.archive.org/web/20101203013357/http://www.nyse.com/about/newsevents/1176373643795.html
#Friday 12/31 - New Years' Day (January 1) in 2011 falls on a Saturday. The rules of the applicable exchanges state that when a holiday falls on a Saturday, we observe the preceding Friday unless the Friday is the end of a monthly or yearly account...
if ($month == 1 and $day == 1 and $wday >= 1 and $wday <= 5) { #New Year's Day on a Weekday
return q{New Year's Day};
} elsif ($month == 1 and $day == 2 and $wday == 1) { #Monday after New Year's Day
return q{New Year's Day Observed};
} elsif ($month == 1 and $day >= 15 and $day <= 21 and $wday == 1) { #Third Monday in January
return 'Martin Luther King, Jr. Day';
} elsif ($month == 2 and $day >= 15 and $day <= 21 and $wday == 1) { #Third Monday in February
return q{Washington's Birthday};
t/200_year_2017.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20170702003212/https://www.nyse.com/markets/hours-calendars
my $year = 2017;
is( is_holiday($year, 1, 2), q{New Year's Day Observed});
is( is_holiday($year, 1, 16), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 20), q{Washington's Birthday});
is( is_holiday($year, 4, 14), q{Good Friday});
is( is_holiday($year, 5, 29), q{Memorial Day});
ok(!is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 4), q{Labor Day});
t/200_year_2018.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20170702003212/https://www.nyse.com/markets/hours-calendars
my $year = 2018;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 15), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 19), q{Washington's Birthday});
is( is_holiday($year, 3, 30), q{Good Friday});
is( is_holiday($year, 5, 28), q{Memorial Day});
ok(!is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 3), q{Labor Day});
t/200_year_2019.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20170702003212/https://www.nyse.com/markets/hours-calendars
my $year = 2019;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 21), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 18), q{Washington's Birthday});
is( is_holiday($year, 4, 19), q{Good Friday});
is( is_holiday($year, 5, 27), q{Memorial Day});
ok(!is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 2), q{Labor Day});
t/200_year_2020.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20200530191718/https://www.nyse.com/markets/hours-calendars
my $year = 2020;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 20), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 17), q{Washington's Birthday});
is( is_holiday($year, 4, 10), q{Good Friday});
is( is_holiday($year, 5, 25), q{Memorial Day});
ok(!is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 3), q{Independence Day Observed});
is( is_holiday($year, 9, 7), q{Labor Day});
t/200_year_2021.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20200530191718/https://www.nyse.com/markets/hours-calendars
my $year = 2021;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 18), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 15), q{Washington's Birthday});
is( is_holiday($year, 4, 2), q{Good Friday});
is( is_holiday($year, 5, 31), q{Memorial Day});
ok(!is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 5), q{Independence Day Observed});
is( is_holiday($year, 9, 6), q{Labor Day});
t/200_year_2022.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://web.archive.org/web/20220601133900/https://www.nyse.com/markets/hours-calendars
my $year = 2022;
ok(!is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 17), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 21), q{Washington's Birthday});
is( is_holiday($year, 4, 15), q{Good Friday});
is( is_holiday($year, 5, 30), q{Memorial Day});
is( is_holiday($year, 6, 20), q{Juneteenth National Independence Day Observed});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 5), q{Labor Day});
t/200_year_2023.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://www.nyse.com/markets/hours-calendars
my $year = 2023;
is( is_holiday($year, 1, 2), q{New Year's Day Observed});
is( is_holiday($year, 1, 16), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 20), q{Washington's Birthday});
is( is_holiday($year, 4, 7), q{Good Friday});
is( is_holiday($year, 5, 29), q{Memorial Day});
is( is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 4), q{Labor Day});
t/200_year_2024.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://www.nyse.com/markets/hours-calendars
my $year = 2024;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 15), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 19), q{Washington's Birthday});
is( is_holiday($year, 3, 29), q{Good Friday});
is( is_holiday($year, 5, 27), q{Memorial Day});
is( is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 4), q{Independence Day});
is( is_holiday($year, 9, 2), q{Labor Day});
t/200_year_2025.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 12;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://www.nyse.com/markets/hours-calendars
#From: https://www.nyse.com/index (Dec, 30, 2024) "The U.S stock market will close on Thursday January 9 and the bond market will close early that day in observance of Day of Mourning for Jimmy Carter."
my $year = 2025;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 9), q{Day of Mourning for President Jimmy Carter});
is( is_holiday($year, 1, 20), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 17), q{Washington's Birthday});
is( is_holiday($year, 4, 18), q{Good Friday});
is( is_holiday($year, 5, 26), q{Memorial Day});
is( is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
t/200_year_2026.t view on Meta::CPAN
# - perl -
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Test::More tests => 11;
use Date::Holidays::NYSE qw{is_holiday holidays};
#From: https://www.nyse.com/markets/hours-calendars
my $year = 2026;
is( is_holiday($year, 1, 1), q{New Year's Day});
is( is_holiday($year, 1, 19), q{Martin Luther King, Jr. Day});
is( is_holiday($year, 2, 16), q{Washington's Birthday});
is( is_holiday($year, 4, 3), q{Good Friday});
is( is_holiday($year, 5, 25), q{Memorial Day});
is( is_holiday($year, 6, 19), q{Juneteenth National Independence Day});
is( is_holiday($year, 7, 3), q{Independence Day Observed});
is( is_holiday($year, 9, 7), q{Labor Day});