Created
January 6, 2017 09:39
-
-
Save bessarabov/be47a6739a8fbcbf049124c6015feefc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
=encoding UTF-8 | |
=cut | |
=head1 DESCRIPTION | |
=cut | |
# common modules | |
use strict; | |
use warnings FATAL => 'all'; | |
use feature 'say'; | |
use utf8; | |
use open qw(:std :utf8); | |
use Moment; | |
use Date::Holidays::RU qw(is_holiday is_business_day); | |
# global vars | |
# subs | |
# main | |
sub main { | |
my $start = Moment->new( dt => '2016-12-29 00:00:00'); | |
my $end = Moment->new( dt => '2017-01-31 23:59:59'); | |
my $format = "%10s %-10s %-20s %-20s"; | |
say sprintf | |
$format, | |
'', | |
'', | |
'is_holiday', | |
'is_business_day', | |
; | |
my $current = $start; | |
while ( $current->cmp($end) == -1 ) { | |
say sprintf | |
$format, | |
$current->get_d(), | |
($current->is_saturday() or $current->is_sunday()) ? $current->get_weekday_name() : '' , | |
is_holiday($current->get_year(), $current->get_month(), $current->get_day()) ? '1' : '', | |
is_business_day($current->get_year(), $current->get_month(), $current->get_day()) ? '1' : '', | |
; | |
$current = $current->plus( day => 1 ); | |
} | |
say '#END'; | |
} | |
main(); | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment