Lines 177-198
sub addDays {
Link Here
|
177 |
sub is_holiday { |
177 |
sub is_holiday { |
178 |
my ( $self, $dt ) = @_; |
178 |
my ( $self, $dt ) = @_; |
179 |
my $localdt = $dt->clone(); |
179 |
my $localdt = $dt->clone(); |
|
|
180 |
my $day = $localdt->day; |
181 |
my $month = $localdt->month; |
182 |
|
183 |
$localdt->truncate( to => 'day' ); |
184 |
|
185 |
if ( $self->{exception_holidays}->contains($localdt) ) { |
186 |
# exceptions are not holidays |
187 |
return 0; |
188 |
} |
189 |
|
180 |
my $dow = $localdt->day_of_week; |
190 |
my $dow = $localdt->day_of_week; |
|
|
191 |
# Representation fix |
192 |
# TODO: Shouldn't we shift the rest of the $dow also? |
181 |
if ( $dow == 7 ) { |
193 |
if ( $dow == 7 ) { |
182 |
$dow = 0; |
194 |
$dow = 0; |
183 |
} |
195 |
} |
|
|
196 |
|
184 |
if ( $self->{weekly_closed_days}->[$dow] == 1 ) { |
197 |
if ( $self->{weekly_closed_days}->[$dow] == 1 ) { |
185 |
return 1; |
198 |
return 1; |
186 |
} |
199 |
} |
187 |
$localdt->truncate( to => 'day' ); |
200 |
|
188 |
my $day = $localdt->day; |
|
|
189 |
my $month = $localdt->month; |
190 |
if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) { |
201 |
if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) { |
191 |
return 1; |
202 |
return 1; |
192 |
} |
203 |
} |
193 |
if ( $self->{exception_holidays}->contains($localdt) ) { |
204 |
|
194 |
return 1; |
|
|
195 |
} |
196 |
if ( $self->{single_holidays}->contains($localdt) ) { |
205 |
if ( $self->{single_holidays}->contains($localdt) ) { |
197 |
return 1; |
206 |
return 1; |
198 |
} |
207 |
} |
199 |
- |
|
|