line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
83508
|
use warnings; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Aruba's official holidays |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Exporter qw(import); |
8
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
74
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw( |
10
|
|
|
|
|
|
|
holidays |
11
|
|
|
|
|
|
|
is_holiday |
12
|
|
|
|
|
|
|
is_holiday_dt |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use base qw(Date::Holidays::Abstract); |
16
|
1
|
|
|
1
|
|
7
|
use DateTime::Event::Easter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
410
|
|
17
|
1
|
|
|
1
|
|
7060
|
use DateTime; |
|
1
|
|
|
|
|
494531
|
|
|
1
|
|
|
|
|
47
|
|
18
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
781
|
|
19
|
|
|
|
|
|
|
my %FIXED_DATES = ( |
20
|
|
|
|
|
|
|
'newyears' => { |
21
|
|
|
|
|
|
|
m => 1, |
22
|
|
|
|
|
|
|
d => 1, |
23
|
|
|
|
|
|
|
pap => "A\x{00F1}a Nobo", |
24
|
|
|
|
|
|
|
nl => 'Nieuwjaarsdag', |
25
|
|
|
|
|
|
|
en => 'New years day', |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
'betico' => { |
28
|
|
|
|
|
|
|
m => 1, |
29
|
|
|
|
|
|
|
d => 25, |
30
|
|
|
|
|
|
|
pap => 'Dia di Betico', |
31
|
|
|
|
|
|
|
nl => 'Betico-dag', |
32
|
|
|
|
|
|
|
en => 'Betico day', |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'flagday' => { |
35
|
|
|
|
|
|
|
m => 3, |
36
|
|
|
|
|
|
|
d => 18, |
37
|
|
|
|
|
|
|
pap => 'Dia di Himno y Bandera', |
38
|
|
|
|
|
|
|
nl => 'Nationale vlag en volkslied', |
39
|
|
|
|
|
|
|
en => 'Flag day', |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
'wimlex' => { |
42
|
|
|
|
|
|
|
m => 4, |
43
|
|
|
|
|
|
|
d => 27, |
44
|
|
|
|
|
|
|
nl => 'Koningsdag', |
45
|
|
|
|
|
|
|
en => 'Kings day', |
46
|
|
|
|
|
|
|
pap => 'Dia di Rei', |
47
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
48
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
49
|
|
|
|
|
|
|
year_started => 2014, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'minna-princess' => { |
52
|
|
|
|
|
|
|
m => 8, |
53
|
|
|
|
|
|
|
d => 31, |
54
|
|
|
|
|
|
|
nl => 'Prinsessedag', |
55
|
|
|
|
|
|
|
en => "Princess's day", |
56
|
|
|
|
|
|
|
pap => 'Dia di Prensesa', |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
59
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
60
|
|
|
|
|
|
|
year_started => 1885, |
61
|
|
|
|
|
|
|
year_ended => 1890, |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
'minna-queen' => { |
64
|
|
|
|
|
|
|
m => 8, |
65
|
|
|
|
|
|
|
d => 31, |
66
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
67
|
|
|
|
|
|
|
en => "Queen's day", |
68
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
71
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
72
|
|
|
|
|
|
|
year_started => 1891, |
73
|
|
|
|
|
|
|
year_ended => 1948, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
'juliana-beatrix' => { |
76
|
|
|
|
|
|
|
m => 4, |
77
|
|
|
|
|
|
|
d => 30, |
78
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
79
|
|
|
|
|
|
|
en => "Queen's day", |
80
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
83
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
84
|
|
|
|
|
|
|
year_started => 1949, |
85
|
|
|
|
|
|
|
year_ended => 1979, |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
'juliana-beatrix-2' => { |
88
|
|
|
|
|
|
|
m => 4, |
89
|
|
|
|
|
|
|
d => 30, |
90
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
91
|
|
|
|
|
|
|
en => "Queen's day", |
92
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
95
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
96
|
|
|
|
|
|
|
year_started => 1980, |
97
|
|
|
|
|
|
|
year_ended => 2013, |
98
|
|
|
|
|
|
|
}, |
99
|
|
|
|
|
|
|
'labor' => { |
100
|
|
|
|
|
|
|
m => 5, |
101
|
|
|
|
|
|
|
d => 1, |
102
|
|
|
|
|
|
|
pap => 'Dia di Labor/Dia di Obrero', |
103
|
|
|
|
|
|
|
nl => 'Dag van de arbeid', |
104
|
|
|
|
|
|
|
en => 'Labor day', |
105
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
106
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
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
|
962
|
|
162
|
16
|
|
|
|
|
26
|
$year //= DateTime->now()->year; |
163
|
|
|
|
|
|
|
|
164
|
16
|
|
66
|
|
|
39
|
my $key = $year; |
165
|
|
|
|
|
|
|
if ($args{gov}) { |
166
|
16
|
|
|
|
|
264
|
$key .= 'gov'; |
167
|
16
|
50
|
|
|
|
35
|
} |
168
|
0
|
|
|
|
|
0
|
|
169
|
|
|
|
|
|
|
return $cache{$key} if $cache{$key}; |
170
|
|
|
|
|
|
|
|
171
|
16
|
100
|
|
|
|
38
|
my %h; |
172
|
|
|
|
|
|
|
foreach (keys %FIXED_DATES) { |
173
|
8
|
|
|
|
|
10
|
my $holiday = $FIXED_DATES{$_}; |
174
|
8
|
|
|
|
|
33
|
|
175
|
88
|
|
|
|
|
671
|
if (my $int = $holiday->{interval}) { |
176
|
|
|
|
|
|
|
if ($args{gov} && $holiday->{gov}) { |
177
|
88
|
50
|
|
|
|
167
|
# 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
|
|
|
|
142
|
} |
187
|
40
|
100
|
|
|
|
67
|
|
188
|
|
|
|
|
|
|
if (my $end = $holiday->{year_ended}) { |
189
|
|
|
|
|
|
|
next if $year > $end; |
190
|
82
|
100
|
|
|
|
126
|
} |
191
|
30
|
100
|
|
|
|
65
|
|
192
|
|
|
|
|
|
|
my $dt = _to_date($holiday->{d}, $holiday->{m}, $year); |
193
|
|
|
|
|
|
|
|
194
|
56
|
|
|
|
|
107
|
if (my $dow = $holiday->{dow}) { |
195
|
|
|
|
|
|
|
my $cur = $dt->dow(); |
196
|
56
|
100
|
|
|
|
14735
|
foreach (keys %$dow) { |
197
|
16
|
|
|
|
|
40
|
next unless $cur == $_; |
198
|
16
|
|
|
|
|
60
|
$dt->add(days => $dow->{$_}); |
199
|
16
|
100
|
|
|
|
39
|
last; |
200
|
4
|
|
|
|
|
13
|
} |
201
|
4
|
|
|
|
|
2867
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
_to_holidays(\%h, $dt, $holiday); |
204
|
|
|
|
|
|
|
} |
205
|
56
|
|
|
|
|
103
|
|
206
|
|
|
|
|
|
|
my $dt = _to_date(1, 1, $year); |
207
|
|
|
|
|
|
|
foreach (keys %EASTER_BASED) { |
208
|
8
|
|
|
|
|
43
|
my $holiday = $EASTER_BASED{$_}; |
209
|
8
|
|
|
|
|
2006
|
my $easter = DateTime::Event::Easter->new( |
210
|
40
|
|
|
|
|
454
|
easter => 'western', |
211
|
|
|
|
|
|
|
day => $holiday->{d} |
212
|
|
|
|
|
|
|
); |
213
|
|
|
|
|
|
|
my $dt = $easter->following($dt); |
214
|
40
|
|
|
|
|
104
|
_to_holidays(\%h, $dt, $holiday); |
215
|
40
|
|
|
|
|
5643
|
} |
216
|
40
|
|
|
|
|
65591
|
|
217
|
|
|
|
|
|
|
$cache{$key} = \%h; |
218
|
|
|
|
|
|
|
|
219
|
8
|
|
|
|
|
120
|
return \%h; |
220
|
|
|
|
|
|
|
} |
221
|
8
|
|
|
|
|
27
|
|
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
|
|
161
|
} |
226
|
|
|
|
|
|
|
|
227
|
96
|
|
|
|
|
135
|
my ($day, $month, $year) = @_; |
|
288
|
|
|
|
|
647
|
|
228
|
|
|
|
|
|
|
return DateTime->new( |
229
|
|
|
|
|
|
|
day => $day, |
230
|
|
|
|
|
|
|
month => $month, |
231
|
77
|
|
|
77
|
|
127
|
year => $year, |
232
|
77
|
|
|
|
|
190
|
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
|
3169
|
return is_holiday_dt($dt, @_); |
245
|
13
|
|
|
|
|
19
|
} |
246
|
13
|
|
|
|
|
15
|
|
247
|
|
|
|
|
|
|
my $dt = shift; |
248
|
13
|
|
|
|
|
21
|
|
249
|
13
|
|
|
|
|
3486
|
my %args = @_; |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
my $holidays = holidays($dt->year, @_); |
252
|
|
|
|
|
|
|
my $key = sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month); |
253
|
14
|
|
|
14
|
1
|
251
|
|
254
|
|
|
|
|
|
|
if (exists $holidays->{$key}) { |
255
|
14
|
|
|
|
|
22
|
my $lang = lc(delete $args{lang} // 'pap'); |
256
|
|
|
|
|
|
|
if ($lang eq 'nl' || $lang eq 'nld') { |
257
|
14
|
|
|
|
|
28
|
return $holidays->{$key}[1]; |
258
|
14
|
|
|
|
|
29
|
} |
259
|
|
|
|
|
|
|
if ($lang eq 'en' || $lang eq 'eng') { |
260
|
14
|
100
|
|
|
|
125
|
return $holidays->{$key}[2]; |
261
|
12
|
|
100
|
|
|
45
|
} |
262
|
12
|
100
|
66
|
|
|
37
|
# default to pap |
263
|
1
|
|
|
|
|
6
|
return $holidays->{$key}[0]; |
264
|
|
|
|
|
|
|
} |
265
|
11
|
100
|
66
|
|
|
28
|
return; |
266
|
1
|
|
|
|
|
6
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
'Aruba dushi terra'; |
269
|
10
|
|
|
|
|
69
|
|
270
|
|
|
|
|
|
|
|
271
|
2
|
|
|
|
|
11
|
=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.005 |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head1 SYNOPSIS |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
use Date::Holidays::AW; |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
if (my $thing = is_holiday(2020, 3, 18, lang => 'en')) { |
288
|
|
|
|
|
|
|
print "It is $thing!", $/; # prints 'It is Betico day!' |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head1 DESCRIPTION |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
A L<Date::Holidays> family member from Aruba |
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
|
|
|
|
|
|
|
'2020', '3', '18', |
304
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
305
|
|
|
|
|
|
|
lang => 'en' # defaults to pap, alternatively nl/nld or en/eng can be used. |
306
|
|
|
|
|
|
|
); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head2 is_holiday_dt(dt, %additional) |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
is_holiday_dt( |
311
|
|
|
|
|
|
|
DateTime->new( |
312
|
|
|
|
|
|
|
year => 2020, |
313
|
|
|
|
|
|
|
month => 3, |
314
|
|
|
|
|
|
|
day => 18, |
315
|
|
|
|
|
|
|
time_zone => 'America/Curacao', |
316
|
|
|
|
|
|
|
), |
317
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
318
|
|
|
|
|
|
|
lang => 'en' # defaults to pap, alternatively nl/nld or 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 UTF-8 |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
Be aware that we return UTF-8 when Papiamento is chosen. So make sure you set |
330
|
|
|
|
|
|
|
your enconding to UTF-8, otherwise you may see weird things. |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=head1 AUTHOR |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
This is free software, licensed under: |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
The (three-clause) BSD License |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=cut |