line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
82446
|
use utf8; |
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
5
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
4
|
|
|
|
|
|
|
use strict; |
5
|
1
|
|
|
1
|
|
402
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
6
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Bonaire'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
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
396
|
|
19
|
1
|
|
|
1
|
|
6697
|
use DateTime; |
|
1
|
|
|
|
|
479080
|
|
|
1
|
|
|
|
|
46
|
|
20
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
809
|
|
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
|
|
|
|
|
|
|
rincon => { |
30
|
|
|
|
|
|
|
m => 4, |
31
|
|
|
|
|
|
|
d => 30, |
32
|
|
|
|
|
|
|
pap => 'Dia di Rincon', |
33
|
|
|
|
|
|
|
nl => 'Dag van Rincon', |
34
|
|
|
|
|
|
|
en => 'Rincon day', |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
kingdom => { |
37
|
|
|
|
|
|
|
m => 12, |
38
|
|
|
|
|
|
|
d => 15, |
39
|
|
|
|
|
|
|
pap => 'Dia di Reino', |
40
|
|
|
|
|
|
|
nl => 'Dag van het koninkrijk', |
41
|
|
|
|
|
|
|
en => 'Kingdom day', |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
flagday => { |
44
|
|
|
|
|
|
|
m => 9, |
45
|
|
|
|
|
|
|
d => 6, |
46
|
|
|
|
|
|
|
pap => 'Dia di Boneiru', |
47
|
|
|
|
|
|
|
nl => 'Bonairedag', |
48
|
|
|
|
|
|
|
en => 'Bonaire Flag day', |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
emancipation => { |
51
|
|
|
|
|
|
|
m => 7, |
52
|
|
|
|
|
|
|
d => 1, |
53
|
|
|
|
|
|
|
pap => 'Dia di Lucha pa Libertat', |
54
|
|
|
|
|
|
|
nl => 'Keto Koti', |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Abolish slavery day would have been more appropiate as emancipation |
57
|
|
|
|
|
|
|
# is very neutral |
58
|
|
|
|
|
|
|
en => 'Emancipation day', |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
wimlex => { |
61
|
|
|
|
|
|
|
m => 4, |
62
|
|
|
|
|
|
|
d => 27, |
63
|
|
|
|
|
|
|
nl => 'Koningsdag', |
64
|
|
|
|
|
|
|
en => 'Kings day', |
65
|
|
|
|
|
|
|
pap => 'Dia di Reino', |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
68
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
69
|
|
|
|
|
|
|
year_started => 2014, |
70
|
|
|
|
|
|
|
}, |
71
|
|
|
|
|
|
|
'minna-princess' => { |
72
|
|
|
|
|
|
|
m => 8, |
73
|
|
|
|
|
|
|
d => 31, |
74
|
|
|
|
|
|
|
nl => 'Prinsessedag', |
75
|
|
|
|
|
|
|
en => "Princess's day", |
76
|
|
|
|
|
|
|
pap => 'Dia di Prensesa', |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
79
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
80
|
|
|
|
|
|
|
year_started => 1885, |
81
|
|
|
|
|
|
|
year_ended => 1890, |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
'minna-queen' => { |
84
|
|
|
|
|
|
|
m => 8, |
85
|
|
|
|
|
|
|
d => 31, |
86
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
87
|
|
|
|
|
|
|
en => "Queen's day", |
88
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
91
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
92
|
|
|
|
|
|
|
year_started => 1891, |
93
|
|
|
|
|
|
|
year_ended => 1948, |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
'juliana-beatrix' => { |
96
|
|
|
|
|
|
|
m => 4, |
97
|
|
|
|
|
|
|
d => 30, |
98
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
99
|
|
|
|
|
|
|
en => "Queen's day", |
100
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
103
|
|
|
|
|
|
|
dow => { 7 => 1 }, |
104
|
|
|
|
|
|
|
year_started => 1949, |
105
|
|
|
|
|
|
|
year_ended => 1979, |
106
|
|
|
|
|
|
|
}, |
107
|
|
|
|
|
|
|
'juliana-beatrix-2' => { |
108
|
|
|
|
|
|
|
m => 4, |
109
|
|
|
|
|
|
|
d => 30, |
110
|
|
|
|
|
|
|
nl => 'Koninginnedag', |
111
|
|
|
|
|
|
|
en => "Queen's day", |
112
|
|
|
|
|
|
|
pap => 'Dia di Reina', |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# change day of week if it falls on a sunday |
115
|
|
|
|
|
|
|
dow => { 7 => -1 }, |
116
|
|
|
|
|
|
|
year_started => 1980, |
117
|
|
|
|
|
|
|
year_ended => 2013, |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
labor => { |
120
|
|
|
|
|
|
|
m => 5, |
121
|
|
|
|
|
|
|
d => 1, |
122
|
|
|
|
|
|
|
pap => 'Dia di Labor/Dia di Obrero', |
123
|
|
|
|
|
|
|
nl => 'Dag van de arbeid', |
124
|
|
|
|
|
|
|
en => 'Labor day', |
125
|
|
|
|
|
|
|
}, |
126
|
|
|
|
|
|
|
xmas => { |
127
|
|
|
|
|
|
|
m => 12, |
128
|
|
|
|
|
|
|
d => 25, |
129
|
|
|
|
|
|
|
pap => 'Pasco di Nacemento', |
130
|
|
|
|
|
|
|
nl => 'Kerst', |
131
|
|
|
|
|
|
|
en => 'Christmas', |
132
|
|
|
|
|
|
|
}, |
133
|
|
|
|
|
|
|
boxing => { |
134
|
|
|
|
|
|
|
m => 12, |
135
|
|
|
|
|
|
|
d => 26, |
136
|
|
|
|
|
|
|
pap => 'Di dos dia di Pasco di Nacemento', |
137
|
|
|
|
|
|
|
nl => 'Tweede kerstdag', |
138
|
|
|
|
|
|
|
en => 'Boxing day', |
139
|
|
|
|
|
|
|
}, |
140
|
|
|
|
|
|
|
); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my %EASTER_BASED = ( |
143
|
|
|
|
|
|
|
goodfri => { |
144
|
|
|
|
|
|
|
d => -2, |
145
|
|
|
|
|
|
|
pap => 'Bierna Santo', |
146
|
|
|
|
|
|
|
nl => 'Goede vrijdag', |
147
|
|
|
|
|
|
|
en => 'Good friday', |
148
|
|
|
|
|
|
|
}, |
149
|
|
|
|
|
|
|
easter => { |
150
|
|
|
|
|
|
|
d => 0, |
151
|
|
|
|
|
|
|
pap => 'Pasco Grandi', |
152
|
|
|
|
|
|
|
nl => 'Pasen', |
153
|
|
|
|
|
|
|
en => 'Easter', |
154
|
|
|
|
|
|
|
}, |
155
|
|
|
|
|
|
|
easter2 => { |
156
|
|
|
|
|
|
|
d => 1, |
157
|
|
|
|
|
|
|
pap => 'Pasco Grandi', |
158
|
|
|
|
|
|
|
nl => 'Tweede paasdag', |
159
|
|
|
|
|
|
|
en => 'Second day of easter', |
160
|
|
|
|
|
|
|
}, |
161
|
|
|
|
|
|
|
ascension => { |
162
|
|
|
|
|
|
|
d => 40, |
163
|
|
|
|
|
|
|
pap => 'Dia di Asuncion', |
164
|
|
|
|
|
|
|
nl => 'Hemelvaartsdag', |
165
|
|
|
|
|
|
|
en => 'Ascension day', |
166
|
|
|
|
|
|
|
}, |
167
|
|
|
|
|
|
|
pentecost => { |
168
|
|
|
|
|
|
|
d => 49, |
169
|
|
|
|
|
|
|
pap => 'Dia di Asuncion', |
170
|
|
|
|
|
|
|
nl => 'Pinksteren', |
171
|
|
|
|
|
|
|
en => 'Pentecost', |
172
|
|
|
|
|
|
|
}, |
173
|
|
|
|
|
|
|
); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my %cache; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
my $year = shift; |
178
|
|
|
|
|
|
|
my %args = @_; |
179
|
18
|
|
|
18
|
1
|
978
|
|
180
|
18
|
|
|
|
|
23
|
$year //= DateTime->now()->year; |
181
|
|
|
|
|
|
|
|
182
|
18
|
|
66
|
|
|
45
|
my $key = $year; |
183
|
|
|
|
|
|
|
if ($args{gov}) { |
184
|
18
|
|
|
|
|
269
|
$key .= 'gov'; |
185
|
18
|
50
|
|
|
|
42
|
} |
186
|
0
|
|
|
|
|
0
|
|
187
|
|
|
|
|
|
|
return $cache{$key} if $cache{$key}; |
188
|
|
|
|
|
|
|
|
189
|
18
|
100
|
|
|
|
46
|
my %h; |
190
|
|
|
|
|
|
|
foreach (keys %FIXED_DATES) { |
191
|
8
|
|
|
|
|
13
|
my $holiday = $FIXED_DATES{$_}; |
192
|
8
|
|
|
|
|
23
|
|
193
|
104
|
|
|
|
|
808
|
if (my $int = $holiday->{interval}) { |
194
|
|
|
|
|
|
|
if ($args{gov} && $holiday->{gov}) { |
195
|
104
|
50
|
|
|
|
178
|
|
196
|
0
|
0
|
0
|
|
|
0
|
# We should have this |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
else { |
199
|
|
|
|
|
|
|
next if $year % $int != 0; |
200
|
|
|
|
|
|
|
} |
201
|
0
|
0
|
|
|
|
0
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
if (my $start = $holiday->{year_started}) { |
204
|
|
|
|
|
|
|
next if $year < $start; |
205
|
104
|
100
|
|
|
|
176
|
} |
206
|
40
|
100
|
|
|
|
67
|
|
207
|
|
|
|
|
|
|
if (my $end = $holiday->{year_ended}) { |
208
|
|
|
|
|
|
|
next if $year > $end; |
209
|
98
|
100
|
|
|
|
146
|
} |
210
|
30
|
100
|
|
|
|
63
|
|
211
|
|
|
|
|
|
|
my $dt = _to_date($holiday->{d}, $holiday->{m}, $year); |
212
|
|
|
|
|
|
|
|
213
|
72
|
|
|
|
|
122
|
if (my $dow = $holiday->{dow}) { |
214
|
|
|
|
|
|
|
my $cur = $dt->dow(); |
215
|
72
|
100
|
|
|
|
18521
|
foreach (keys %$dow) { |
216
|
8
|
|
|
|
|
22
|
next unless $cur == $_; |
217
|
8
|
|
|
|
|
33
|
$dt->add(days => $dow->{$_}); |
218
|
8
|
100
|
|
|
|
23
|
last; |
219
|
3
|
|
|
|
|
11
|
} |
220
|
3
|
|
|
|
|
2210
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
_to_holidays(\%h, $dt, $holiday); |
223
|
|
|
|
|
|
|
} |
224
|
72
|
|
|
|
|
127
|
|
225
|
|
|
|
|
|
|
my $dt = _to_date(1, 1, $year); |
226
|
|
|
|
|
|
|
foreach (keys %EASTER_BASED) { |
227
|
8
|
|
|
|
|
59
|
my $holiday = $EASTER_BASED{$_}; |
228
|
8
|
|
|
|
|
2030
|
my $easter = DateTime::Event::Easter->new( |
229
|
40
|
|
|
|
|
449
|
easter => 'western', |
230
|
|
|
|
|
|
|
day => $holiday->{d} |
231
|
|
|
|
|
|
|
); |
232
|
|
|
|
|
|
|
my $dt = $easter->following($dt); |
233
|
40
|
|
|
|
|
116
|
_to_holidays(\%h, $dt, $holiday); |
234
|
40
|
|
|
|
|
5500
|
} |
235
|
40
|
|
|
|
|
64909
|
|
236
|
|
|
|
|
|
|
$cache{$key} = \%h; |
237
|
|
|
|
|
|
|
|
238
|
8
|
|
|
|
|
119
|
return \%h; |
239
|
|
|
|
|
|
|
} |
240
|
8
|
|
|
|
|
31
|
|
241
|
|
|
|
|
|
|
my ($cache, $dt, $info) = @_; |
242
|
|
|
|
|
|
|
$cache->{ sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month) } |
243
|
|
|
|
|
|
|
= [map { $info->{$_} } qw(pap nl en)]; |
244
|
112
|
|
|
112
|
|
192
|
} |
245
|
|
|
|
|
|
|
|
246
|
112
|
|
|
|
|
159
|
my ($day, $month, $year) = @_; |
|
336
|
|
|
|
|
717
|
|
247
|
|
|
|
|
|
|
return DateTime->new( |
248
|
|
|
|
|
|
|
day => $day, |
249
|
|
|
|
|
|
|
month => $month, |
250
|
95
|
|
|
95
|
|
136
|
year => $year, |
251
|
95
|
|
|
|
|
221
|
hour => 0, |
252
|
|
|
|
|
|
|
minute => 0, |
253
|
|
|
|
|
|
|
second => 0, |
254
|
|
|
|
|
|
|
time_zone => 'UTC', |
255
|
|
|
|
|
|
|
); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
my $year = shift; |
259
|
|
|
|
|
|
|
my $month = shift; |
260
|
|
|
|
|
|
|
my $day = shift; |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
my $dt = _to_date($day, $month, $year); |
263
|
15
|
|
|
15
|
1
|
2647
|
return is_holiday_dt($dt, @_); |
264
|
15
|
|
|
|
|
21
|
} |
265
|
15
|
|
|
|
|
19
|
|
266
|
|
|
|
|
|
|
my $dt = shift; |
267
|
15
|
|
|
|
|
24
|
|
268
|
15
|
|
|
|
|
4021
|
my %args = @_; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
my $holidays = holidays($dt->year, @_); |
271
|
|
|
|
|
|
|
my $key = sprintf("%02i", $dt->day) . sprintf("%02i", $dt->month); |
272
|
16
|
|
|
16
|
1
|
256
|
|
273
|
|
|
|
|
|
|
if (exists $holidays->{$key}) { |
274
|
16
|
|
|
|
|
26
|
my $lang = lc(delete $args{lang} // 'pap'); |
275
|
|
|
|
|
|
|
if ($lang eq 'nl' || $lang eq 'nld') { |
276
|
16
|
|
|
|
|
35
|
return $holidays->{$key}[1]; |
277
|
16
|
|
|
|
|
35
|
} |
278
|
|
|
|
|
|
|
if ($lang eq 'en' || $lang eq 'eng') { |
279
|
16
|
100
|
|
|
|
147
|
return $holidays->{$key}[2]; |
280
|
14
|
|
100
|
|
|
49
|
} |
281
|
14
|
100
|
66
|
|
|
46
|
|
282
|
1
|
|
|
|
|
6
|
# default to pap |
283
|
|
|
|
|
|
|
return $holidays->{$key}[0]; |
284
|
13
|
100
|
66
|
|
|
38
|
} |
285
|
1
|
|
|
|
|
6
|
return; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
'Aruba dushi terra'; |
289
|
12
|
|
|
|
|
76
|
|
290
|
|
|
|
|
|
|
|
291
|
2
|
|
|
|
|
12
|
=pod |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=encoding UTF-8 |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 NAME |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Date::Holidays::BQ - Bonaire's official holidays |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 VERSION |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
version 0.001 |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 SYNOPSIS |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
use Date::Holidays::BQ; |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
if (my $thing = is_holiday(2020, 4, 30, lang => 'en')) { |
308
|
|
|
|
|
|
|
print "It is $thing!", $/; # prints 'It is Bonaire Flag day!' |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head1 DESCRIPTION |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
A L<Date::Holidays> family member from Bonaire |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head1 METHODS |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
This module implements the C<is_holiday> and C<holiday> functions from |
318
|
|
|
|
|
|
|
L<Date::Holidays::Abstract>. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=head2 is_holiday(yyyy, mm, dd, %additional) |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
is_holiday( |
323
|
|
|
|
|
|
|
'2020', '4', '30', |
324
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
325
|
|
|
|
|
|
|
lang => 'en' # defaults to pap, alternatively nl/nld or en/eng can be used. |
326
|
|
|
|
|
|
|
); |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head2 is_holiday_dt(dt, %additional) |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
is_holiday_dt( |
331
|
|
|
|
|
|
|
DateTime->new( |
332
|
|
|
|
|
|
|
year => 2020, |
333
|
|
|
|
|
|
|
month => 4, |
334
|
|
|
|
|
|
|
day => 30, |
335
|
|
|
|
|
|
|
time_zone => 'America/Curacao', |
336
|
|
|
|
|
|
|
), |
337
|
|
|
|
|
|
|
gov => 1, # Important for government institutions |
338
|
|
|
|
|
|
|
lang => 'en' # defaults to pap, alternatively nl/nld or en/eng can be used. |
339
|
|
|
|
|
|
|
); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=head2 holidays(yyyy, gov => 1) |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
holidays('2022', gov => 1); |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Similar API to the other functions, returns an hashref for the year. |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=head1 AUTHOR |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Wesley Schwengle. |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
This is free software, licensed under: |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
The (three-clause) BSD License |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |