line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
103804
|
use utf8; |
|
1
|
|
|
|
|
35
|
|
|
1
|
|
|
|
|
5
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Date::Holidays::AW; |
4
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
5
|
1
|
|
|
1
|
|
61
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Aruba's official holidays |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
13
|
|
|
|
|
|
|
holidays |
14
|
|
|
|
|
|
|
is_holiday |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
9
|
use base qw(Date::Holidays::Abstract); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
548
|
|
18
|
1
|
|
|
1
|
|
8861
|
use DateTime::Event::Easter; |
|
1
|
|
|
|
|
559395
|
|
|
1
|
|
|
|
|
58
|
|
19
|
1
|
|
|
1
|
|
10
|
use DateTime; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
824
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %FIXED_DATES = ( |
22
|
|
|
|
|
|
|
'newyears' => { |
23
|
|
|
|
|
|
|
m => 1, |
24
|
|
|
|
|
|
|
d => 1, |
25
|
|
|
|
|
|
|
pap => 'Aña Nobo', |
26
|
|
|
|
|
|
|
nl => 'Nieuwjaarsdag', |
27
|
|
|
|
|
|
|
en => 'New years day', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
'betico' => { |
30
|
|
|
|
|
|
|
m => 1, |
31
|
|
|
|
|
|
|
d => 25, |
32
|
|
|
|
|
|
|
pap => 'Dia di Betico', |
33
|
|
|
|
|
|
|
nl => 'Betico-dag', |
34
|
|
|
|
|
|
|
en => 'Betico day', |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
'flagday' => { |
37
|
|
|
|
|
|
|
m => 3, |
38
|
|
|
|
|
|
|
d => 18, |
39
|
|
|
|
|
|
|
pap => 'Na dia di Himno y Bandera', |
40
|
|
|
|
|
|
|
nl => 'Nationale vlag en volkslied', |
41
|
|
|
|
|
|
|
en => 'Flag day', |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
'wimlex' => { |
44
|
|
|
|
|
|
|
m => 4, |
45
|
|
|
|
|
|
|
d => 27, |
46
|
|
|
|
|
|
|
nl => 'Koningsdag', |
47
|
|
|
|
|
|
|
en => 'Kings day', |
48
|
|
|
|
|
|
|
pap => 'Dia di Reino', |
49
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
50
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
51
|
|
|
|
|
|
|
year_started => 2014, |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
'minna-princess' => { |
54
|
|
|
|
|
|
|
m => 8, |
55
|
|
|
|
|
|
|
d => 31, |
56
|
|
|
|
|
|
|
nl => 'Prinsessedag', |
57
|
|
|
|
|
|
|
en => "Princess's day", |
58
|
|
|
|
|
|
|
pap => 'Dia di Prensesa', |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
61
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
62
|
|
|
|
|
|
|
year_started => 1885, |
63
|
|
|
|
|
|
|
year_ended => 1890, |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
'minna-queen' => { |
66
|
|
|
|
|
|
|
m => 8, |
67
|
|
|
|
|
|
|
d => 31, |
68
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
69
|
|
|
|
|
|
|
en => "Queen's day", |
70
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
73
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
74
|
|
|
|
|
|
|
year_started => 1891, |
75
|
|
|
|
|
|
|
year_ended => 1948, |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
'juliana-beatrix' => { |
78
|
|
|
|
|
|
|
m => 4, |
79
|
|
|
|
|
|
|
d => 30, |
80
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
81
|
|
|
|
|
|
|
en => "Queen's day", |
82
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
85
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
86
|
|
|
|
|
|
|
year_started => 1949, |
87
|
|
|
|
|
|
|
year_ended => 1979, |
88
|
|
|
|
|
|
|
}, |
89
|
|
|
|
|
|
|
'juliana-beatrix-2' => { |
90
|
|
|
|
|
|
|
m => 4, |
91
|
|
|
|
|
|
|
d => 30, |
92
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
93
|
|
|
|
|
|
|
en => "Queen's day", |
94
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
97
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
98
|
|
|
|
|
|
|
year_started => 1980, |
99
|
|
|
|
|
|
|
year_ended => 2013, |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
'labor' => { |
102
|
|
|
|
|
|
|
m => 5, |
103
|
|
|
|
|
|
|
d => 1, |
104
|
|
|
|
|
|
|
pap => 'Dia di Labor/Dia di Obrero', |
105
|
|
|
|
|
|
|
nl => 'Dag van de arbeid', |
106
|
|
|
|
|
|
|
en => 'Labor day', |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
'xmas' => { |
109
|
|
|
|
|
|
|
m => 12, |
110
|
|
|
|
|
|
|
d => 25, |
111
|
|
|
|
|
|
|
pap => 'Pasco di Nacemento', |
112
|
|
|
|
|
|
|
nl => 'Kerst', |
113
|
|
|
|
|
|
|
en => 'Christmas', |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
'boxing' => { |
116
|
|
|
|
|
|
|
m => 12, |
117
|
|
|
|
|
|
|
d => 26, |
118
|
|
|
|
|
|
|
pap => 'Di dos dia di Pasco di Nacemento', |
119
|
|
|
|
|
|
|
nl => 'Tweede kerstdag', |
120
|
|
|
|
|
|
|
en => 'Boxing day', |
121
|
|
|
|
|
|
|
}, |
122
|
|
|
|
|
|
|
); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my %EASTER_BASED = ( |
125
|
|
|
|
|
|
|
'carnaval' => { |
126
|
|
|
|
|
|
|
d => -48, |
127
|
|
|
|
|
|
|
pap => 'Despues di Carnaval grandi', |
128
|
|
|
|
|
|
|
nl => 'Carnavalsmaandag', |
129
|
|
|
|
|
|
|
en => 'Carnaval monday', |
130
|
|
|
|
|
|
|
}, |
131
|
|
|
|
|
|
|
'goodfri' => { |
132
|
|
|
|
|
|
|
d => -2, |
133
|
|
|
|
|
|
|
pap => 'Bierna Santo', |
134
|
|
|
|
|
|
|
nl => 'Goede vrijdag', |
135
|
|
|
|
|
|
|
en => 'Good friday', |
136
|
|
|
|
|
|
|
}, |
137
|
|
|
|
|
|
|
'easter' => { |
138
|
|
|
|
|
|
|
d => 0, |
139
|
|
|
|
|
|
|
pap => 'Pasco Grandi', |
140
|
|
|
|
|
|
|
nl => 'Pasen', |
141
|
|
|
|
|
|
|
en => 'Easter', |
142
|
|
|
|
|
|
|
}, |
143
|
|
|
|
|
|
|
'easter2' => { |
144
|
|
|
|
|
|
|
d => 1, |
145
|
|
|
|
|
|
|
pap => 'Pasco Grandi', |
146
|
|
|
|
|
|
|
nl => 'Tweede paasdag', |
147
|
|
|
|
|
|
|
en => 'Second day of easter', |
148
|
|
|
|
|
|
|
}, |
149
|
|
|
|
|
|
|
'ascension' => { |
150
|
|
|
|
|
|
|
d => 40, |
151
|
|
|
|
|
|
|
pap => 'Dia di Asuncion', |
152
|
|
|
|
|
|
|
nl => 'Hemelvaartsdag', |
153
|
|
|
|
|
|
|
en => 'Ascension day', |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
my %cache; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub holidays { |
160
|
12
|
|
|
12
|
1
|
1076
|
my ($year) = @_; |
161
|
|
|
|
|
|
|
|
162
|
12
|
|
66
|
|
|
41
|
$year //= DateTime->now()->year; |
163
|
|
|
|
|
|
|
|
164
|
12
|
100
|
|
|
|
340
|
return $cache{$year} if $cache{$year}; |
165
|
|
|
|
|
|
|
|
166
|
7
|
|
|
|
|
13
|
my %h; |
167
|
7
|
|
|
|
|
44
|
foreach (keys %FIXED_DATES) { |
168
|
77
|
|
|
|
|
644
|
my $holiday = $FIXED_DATES{$_}; |
169
|
|
|
|
|
|
|
|
170
|
77
|
50
|
|
|
|
156
|
if (my $int = $holiday->{interval}) { |
171
|
0
|
0
|
|
|
|
0
|
next if $year % $int != 0; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
77
|
100
|
|
|
|
206
|
if (my $start = $holiday->{year_started}) { |
175
|
35
|
100
|
|
|
|
72
|
next if $year < $start; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
71
|
100
|
|
|
|
138
|
if (my $end = $holiday->{year_ended}) { |
179
|
26
|
100
|
|
|
|
76
|
next if $year > $end; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
49
|
|
|
|
|
111
|
my $dt = _to_date($holiday->{d}, $holiday->{m}, $year); |
183
|
|
|
|
|
|
|
|
184
|
49
|
100
|
|
|
|
15997
|
if (my $dow = $holiday->{dow}) { |
185
|
7
|
|
|
|
|
26
|
my $cur = $dt->dow(); |
186
|
7
|
|
|
|
|
40
|
foreach (keys %$dow) { |
187
|
7
|
100
|
|
|
|
26
|
next unless $cur == $_; |
188
|
3
|
|
|
|
|
15
|
$dt->add(days => $dow->{$_}); |
189
|
3
|
|
|
|
|
2639
|
last; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
49
|
|
|
|
|
113
|
_to_holidays(\%h, $dt, $holiday); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
7
|
|
|
|
|
100
|
my $dt = _to_date(1, 1, $year); |
197
|
7
|
|
|
|
|
2329
|
foreach (keys %EASTER_BASED) { |
198
|
35
|
|
|
|
|
482
|
my $holiday = $EASTER_BASED{$_}; |
199
|
|
|
|
|
|
|
my $easter = DateTime::Event::Easter->new( |
200
|
|
|
|
|
|
|
easter => 'western', |
201
|
|
|
|
|
|
|
day => $holiday->{d} |
202
|
35
|
|
|
|
|
123
|
); |
203
|
35
|
|
|
|
|
6041
|
my $dt = $easter->following($dt); |
204
|
35
|
|
|
|
|
72145
|
_to_holidays(\%h, $dt, $holiday); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
7
|
|
|
|
|
129
|
$cache{$year} = \%h; |
208
|
|
|
|
|
|
|
|
209
|
7
|
|
|
|
|
34
|
return \%h; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub _to_holidays { |
213
|
84
|
|
|
84
|
|
189
|
my ($cache, $dt, $info) = @_; |
214
|
|
|
|
|
|
|
$cache->{ sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month) } |
215
|
84
|
|
|
|
|
143
|
= [map { $info->{$_} } qw(pap nl en)],; |
|
252
|
|
|
|
|
672
|
|
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub _to_date { |
219
|
66
|
|
|
66
|
|
131
|
my ($day, $month, $year) = @_; |
220
|
66
|
|
|
|
|
180
|
return DateTime->new( |
221
|
|
|
|
|
|
|
day => $day, |
222
|
|
|
|
|
|
|
month => $month, |
223
|
|
|
|
|
|
|
year => $year, |
224
|
|
|
|
|
|
|
hour => 0, |
225
|
|
|
|
|
|
|
minute => 0, |
226
|
|
|
|
|
|
|
second => 0, |
227
|
|
|
|
|
|
|
time_zone => 'UTC', |
228
|
|
|
|
|
|
|
); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub is_holiday { |
232
|
10
|
|
|
10
|
1
|
626
|
my ($year, $month, $day) = @_; |
233
|
|
|
|
|
|
|
|
234
|
10
|
|
|
|
|
21
|
my $holidays = holidays($year); |
235
|
10
|
|
|
|
|
23
|
my $dt = _to_date($day, $month, $year); |
236
|
10
|
|
|
|
|
3444
|
my $key = sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month); |
237
|
10
|
|
|
|
|
172
|
return exists $holidays->{$key}; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
'One happy island'; |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
__END__ |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=pod |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=encoding UTF-8 |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 NAME |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Date::Holidays::AW - Aruba's official holidays |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 VERSION |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
version 0.003 |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 SYNOPSIS |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
use Date::Holidays::AW; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
if (is_holiday(2020, 3, 18)) { |
261
|
|
|
|
|
|
|
print "It is Betico day!", $/; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head1 DESCRIPTION |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
A L<Date::Holidays> family member from Aruba |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head1 METHODS |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
This module implements the C<is_holiday> and C<holiday> functions from |
271
|
|
|
|
|
|
|
L<Date::Holidays::Abstract>. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head1 AUTHOR |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
This is free software, licensed under: |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
The (three-clause) BSD License |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |