line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
84062
|
use utf8; |
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
5
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
4
|
|
|
|
|
|
|
use strict; |
5
|
1
|
|
|
1
|
|
49
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
6
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Aruba's official holidays |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Exporter qw(import); |
10
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw( |
12
|
|
|
|
|
|
|
holidays |
13
|
|
|
|
|
|
|
is_holiday |
14
|
|
|
|
|
|
|
is_holiday_dt |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use base qw(Date::Holidays::Abstract); |
18
|
1
|
|
|
1
|
|
6
|
use DateTime::Event::Easter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
390
|
|
19
|
1
|
|
|
1
|
|
6812
|
use DateTime; |
|
1
|
|
|
|
|
485521
|
|
|
1
|
|
|
|
|
49
|
|
20
|
1
|
|
|
1
|
|
9
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
733
|
|
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
|
|
|
|
|
|
|
my $year = shift; |
160
|
|
|
|
|
|
|
my %args = @_; |
161
|
16
|
|
|
16
|
1
|
942
|
|
162
|
16
|
|
|
|
|
31
|
$year //= DateTime->now()->year; |
163
|
|
|
|
|
|
|
|
164
|
16
|
|
66
|
|
|
46
|
my $key = $year; |
165
|
|
|
|
|
|
|
if ($args{gov}) { |
166
|
16
|
|
|
|
|
266
|
$key .= 'gov'; |
167
|
16
|
50
|
|
|
|
47
|
} |
168
|
0
|
|
|
|
|
0
|
|
169
|
|
|
|
|
|
|
return $cache{$key} if $cache{$key}; |
170
|
|
|
|
|
|
|
|
171
|
16
|
100
|
|
|
|
46
|
my %h; |
172
|
|
|
|
|
|
|
foreach (keys %FIXED_DATES) { |
173
|
8
|
|
|
|
|
9
|
my $holiday = $FIXED_DATES{$_}; |
174
|
8
|
|
|
|
|
33
|
|
175
|
88
|
|
|
|
|
617
|
if (my $int = $holiday->{interval}) { |
176
|
|
|
|
|
|
|
if ($args{gov} && $holiday->{gov}) { |
177
|
88
|
50
|
|
|
|
158
|
# We should have this |
178
|
0
|
0
|
0
|
|
|
0
|
} |
179
|
|
|
|
|
|
|
else { |
180
|
|
|
|
|
|
|
next if $year % $int != 0; |
181
|
|
|
|
|
|
|
} |
182
|
0
|
0
|
|
|
|
0
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
if (my $start = $holiday->{year_started}) { |
185
|
|
|
|
|
|
|
next if $year < $start; |
186
|
88
|
100
|
|
|
|
133
|
} |
187
|
40
|
100
|
|
|
|
67
|
|
188
|
|
|
|
|
|
|
if (my $end = $holiday->{year_ended}) { |
189
|
|
|
|
|
|
|
next if $year > $end; |
190
|
82
|
100
|
|
|
|
117
|
} |
191
|
30
|
100
|
|
|
|
52
|
|
192
|
|
|
|
|
|
|
my $dt = _to_date($holiday->{d}, $holiday->{m}, $year); |
193
|
|
|
|
|
|
|
|
194
|
56
|
|
|
|
|
90
|
if (my $dow = $holiday->{dow}) { |
195
|
|
|
|
|
|
|
my $cur = $dt->dow(); |
196
|
56
|
100
|
|
|
|
12939
|
foreach (keys %$dow) { |
197
|
8
|
|
|
|
|
34
|
next unless $cur == $_; |
198
|
8
|
|
|
|
|
37
|
$dt->add(days => $dow->{$_}); |
199
|
8
|
100
|
|
|
|
26
|
last; |
200
|
3
|
|
|
|
|
12
|
} |
201
|
3
|
|
|
|
|
2104
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
_to_holidays(\%h, $dt, $holiday); |
204
|
|
|
|
|
|
|
} |
205
|
56
|
|
|
|
|
92
|
|
206
|
|
|
|
|
|
|
my $dt = _to_date(1, 1, $year); |
207
|
|
|
|
|
|
|
foreach (keys %EASTER_BASED) { |
208
|
8
|
|
|
|
|
35
|
my $holiday = $EASTER_BASED{$_}; |
209
|
8
|
|
|
|
|
1786
|
my $easter = DateTime::Event::Easter->new( |
210
|
40
|
|
|
|
|
421
|
easter => 'western', |
211
|
|
|
|
|
|
|
day => $holiday->{d} |
212
|
|
|
|
|
|
|
); |
213
|
|
|
|
|
|
|
my $dt = $easter->following($dt); |
214
|
40
|
|
|
|
|
134
|
_to_holidays(\%h, $dt, $holiday); |
215
|
40
|
|
|
|
|
5531
|
} |
216
|
40
|
|
|
|
|
59873
|
|
217
|
|
|
|
|
|
|
$cache{$key} = \%h; |
218
|
|
|
|
|
|
|
|
219
|
8
|
|
|
|
|
116
|
return \%h; |
220
|
|
|
|
|
|
|
} |
221
|
8
|
|
|
|
|
38
|
|
222
|
|
|
|
|
|
|
my ($cache, $dt, $info) = @_; |
223
|
|
|
|
|
|
|
$cache->{ sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month) } |
224
|
|
|
|
|
|
|
= [ map { $info->{$_} } qw(pap nl en)]; |
225
|
96
|
|
|
96
|
|
154
|
} |
226
|
|
|
|
|
|
|
|
227
|
96
|
|
|
|
|
127
|
my ($day, $month, $year) = @_; |
|
288
|
|
|
|
|
590
|
|
228
|
|
|
|
|
|
|
return DateTime->new( |
229
|
|
|
|
|
|
|
day => $day, |
230
|
|
|
|
|
|
|
month => $month, |
231
|
77
|
|
|
77
|
|
127
|
year => $year, |
232
|
77
|
|
|
|
|
176
|
hour => 0, |
233
|
|
|
|
|
|
|
minute => 0, |
234
|
|
|
|
|
|
|
second => 0, |
235
|
|
|
|
|
|
|
time_zone => 'UTC', |
236
|
|
|
|
|
|
|
); |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
my $year = shift; |
240
|
|
|
|
|
|
|
my $month = shift; |
241
|
|
|
|
|
|
|
my $day = shift; |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my $dt = _to_date($day, $month, $year); |
244
|
13
|
|
|
13
|
1
|
2716
|
return is_holiday_dt($dt, @_); |
245
|
13
|
|
|
|
|
19
|
} |
246
|
13
|
|
|
|
|
16
|
|
247
|
|
|
|
|
|
|
my $dt = shift; |
248
|
13
|
|
|
|
|
25
|
|
249
|
13
|
|
|
|
|
3103
|
my %args = @_; |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
my $holidays = holidays($dt->year, @_); |
252
|
|
|
|
|
|
|
my $key = sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month); |
253
|
14
|
|
|
14
|
1
|
226
|
|
254
|
|
|
|
|
|
|
if (exists $holidays->{$key}) { |
255
|
14
|
|
|
|
|
21
|
my $lang = lc(delete $args{lang} // 'pap'); |
256
|
|
|
|
|
|
|
if ($lang eq 'nl' || $lang eq 'nld') { |
257
|
14
|
|
|
|
|
30
|
return $holidays->{$key}[1]; |
258
|
14
|
|
|
|
|
32
|
} |
259
|
|
|
|
|
|
|
if ($lang eq 'en' || $lang eq 'eng') { |
260
|
14
|
100
|
|
|
|
130
|
return $holidays->{$key}[2]; |
261
|
12
|
|
100
|
|
|
44
|
} |
262
|
12
|
100
|
66
|
|
|
44
|
# default to pap |
263
|
1
|
|
|
|
|
4
|
return $holidays->{$key}[0]; |
264
|
|
|
|
|
|
|
} |
265
|
11
|
100
|
66
|
|
|
37
|
return; |
266
|
1
|
|
|
|
|
5
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
'Aruba dushi terra'; |
269
|
10
|
|
|
|
|
67
|
|
270
|
|
|
|
|
|
|
|
271
|
2
|
|
|
|
|
18
|
=pod |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=encoding UTF-8 |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head1 NAME |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Date::Holidays::AW - Aruba's official holidays |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head1 VERSION |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
version 0.004 |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head1 SYNOPSIS |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
use Date::Holidays::NL; |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
if (my $thing = is_holiday(2020, 5, 5, lang => 'en')) { |
288
|
|
|
|
|
|
|
print "It is $thing!", $/; # prints liberation day |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head1 DESCRIPTION |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
A L<Date::Holidays> family member from the Netherlands |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 METHODS |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
This module implements the C<is_holiday> and C<holiday> functions from |
298
|
|
|
|
|
|
|
L<Date::Holidays::Abstract>. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=head2 is_holiday(yyyy, mm, dd, %additional) |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
is_holiday( |
303
|
|
|
|
|
|
|
'2022', '05', '05', |
304
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
305
|
|
|
|
|
|
|
lang => 'en' # defaults to nl/nld, alternatively en/eng can be used. |
306
|
|
|
|
|
|
|
); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head2 is_holiday_dt(dt, %additional) |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
is_holiday( |
311
|
|
|
|
|
|
|
DateTime->new( |
312
|
|
|
|
|
|
|
year => 2022, |
313
|
|
|
|
|
|
|
month => 5, |
314
|
|
|
|
|
|
|
day => 5, |
315
|
|
|
|
|
|
|
time_zone => 'Europe/Amsterdam', |
316
|
|
|
|
|
|
|
), |
317
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
318
|
|
|
|
|
|
|
lang => 'en' # defaults to nl/nld, alternatively en/eng can be used. |
319
|
|
|
|
|
|
|
); |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head2 holidays(yyyy, gov => 1) |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
holidays('2022', gov => 1); |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Similar API to the other functions, returns an hashref for the year. |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=head1 AUTHOR |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
This is free software, licensed under: |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
The (three-clause) BSD License |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=cut |