Calendar-Indonesia-Holiday
    
    
  
  
  
view release on metacpan or search on metacpan
0.347   2022-07-05  Released-By: PERLANCAR; Urgency: medium
        - Change Eid Al-Adha 2022 from Jul 9 to Jul 10.
0.346   2022-01-10  Released-By: PERLANCAR; Urgency: low
	- No functional changes.
	- [doc] Document the calendar years supported by this module in the
	  POD.
        - [doc] Mention App::IndonesianHolidayUtils.
0.345   2022-01-10  Released-By: PERLANCAR; Urgency: medium
	- Add 2022 holidays.
        - As mentioned above, old function names are now deprecated:
          list_id_holidays(), count_id_workdays(), enum_id_workdays(), and
          is_id_holiday(). Use the new names.
0.334   2021-01-14  Released-By: PERLANCAR; Urgency: medium
        [Enhancements]
	- Handle case where two or more religious/holidays fall on the same
	  calendar day (e.g. May 8th, 1997).
	[Data]
        - Add holidays for 1990-1999.
	- [bugfix] Forgot to add holidays: legislative election 2004 & 2019.
0.333   2021-01-14  Released-By: PERLANCAR; Urgency: medium
           'identifier'.
0.06     2011-12-14  Released-By: SHARYANTO
         - No library changes. Add command-line script.
0.05     2011-10-05  Released-By: SHARYANTO
         - Fix some calendar mistakes, add holidays from 2002-2007.
0.04     2011-07-19  Released-By: SHARYANTO
         [INCOMPATIBLE CHANGES]
         - enum_id_workdays() (and count_id_workdays()) now accepts 'start_date'
           and 'end_date' arguments instead of 'year'/'mon', to be more flexible
           (list_id_holidays() should probably do too, but this requires
           enhancements to Sub::Spec::Gen::ReadTable first).
     [200, "OK", [
       {date        => '2011-02-16',
        day         => 16,
        month       => 2,
        year        => 2011,
        ind_name    => 'Maulid Nabi Muhammad',
        eng_name    => 'Mawlid',
        eng_aliases => ['Mawlid An-Nabi'],
        ind_aliases => ['Maulud'],
        is_holiday  => 1,
        tags        => [qw/religious religion=islam calendar=lunar/],
       },
       ...
     ]];
    This checks whether 2011-02-16 is a holiday:
     my $res = is_idn_holiday(date => '2011-02-16');
     print "2011-02-16 is a holiday\n" if $res->[2];
    This checks whether 2021-03-11 is a working day:
    information, much like how HTTP response headers provide additional
    metadata.
    Return value: (any)
  list_idn_holidays
    Usage:
     list_idn_holidays(%args) -> [$status_code, $reason, $payload, \%result_meta]
    List Indonesian holidays in calendar.
    List holidays and joint leave days ("cuti bersama").
    Contains data from years 1990 to 2025
    This function is not exported by default, but exportable.
    Arguments ('*' denotes required arguments):
    *   date => *date*
    government program to recommend that some of these leave days be spent
    together nationally on certain assigned days, especially adjacent to
    holidays like Eid Ul-Fitr ("Lebaran"). It is not mandated (companies can
    opt to follow it or not, depending on their specific situation), but
    many do follow it anyway, e.g. government civil workers, banks, etc. I
    am marking joint leave days with is_joint_leave=1 and is_holiday=0,
    while the holidays themselves with is_holiday=1, so you can
    differentiate/select both/either one.
  When was joint leave established?
    Joint leave was first decreed in 2001 [1] for the 2002 & 2003 calendar
    years. The 2001 calendar year does not yet have joint leave days [2].
    See also [3]. Websites that list joint leave days for 2001 or earlier
    years (example: [4], [5]) are incorrect; by 2001 or earlier, these joint
    leave days had not been officially decreed by the government.
    [1] https://jdih.kemnaker.go.id/data_wirata/2002-4-4.pdf
    [2]
    https://peraturan.bkpm.go.id/jdih/userfiles/batang/Kepmenag_162_2000.pdf
    [3] http://www.wikiapbn.org/cuti-bersama/
    [4] https://kalenderindonesia.com/libur/masehi/2001
    [5] https://kalenderindonesia.com/libur/masehi/1991
  What happens when multiple religious/holidays coincide on a single calendar day?
    For example, in 1997, both Hijra and Ascension Day fall on May 8th. When
    this happens, "ind_name" and "eng_name" will contain all the names of
    the holidays separated by comma, respectively:
     Tahun Baru Hijriah, Kenaikan Isa Al-Masih
     Hijra, Ascension Day
    All the properties that have the same value will be set in the merged
    holiday data:
     is_holiday => 1,
     is_joint_leave => 1,
    The "multiple" property will also be set to true:
     multiple => 1,
    All the tags will be merged:
     tags => ['religious', 'religion=christianity', 'calendar=lunar']
    You can get each holiday's data in the "holidays" key.
  Data for older holidays?
    Will be provided if there is demand and data source.
  Holidays after (current year)+1?
    Some religious holidays, especially Vesakha, are not determined yet.
    Joint leave days are also usually decreed by the government in as late
    as October/November in the preceding year.
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
    $opts //= {};
    $r->{ind_name}    = "Tahun Baru Imlek".
        ($opts->{hyear} ? " $opts->{hyear}" . ($year && $year >= 2024 ? " Kongzili" : ""):"");
    $r->{eng_name}    = "Chinese New Year".
        ($opts->{hyear} ? " $opts->{hyear}":"");
    _add_original_date($r, $opts);
    $r->{ind_aliases} = [];
    $r->{eng_aliases} = [];
    $r->{is_holiday}  = 1;
    $r->{year_start}  = 2003; # decreed in 2002 by megawati soekarnoputri
    $r->{tags}        = [qw/international calendar=lunar/];
    ($r);
}
sub _h_mawlid {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Maulid Nabi Muhammad";
    $r->{eng_name}    = "Mawlid";
    _add_original_date($r, $opts);
    $r->{ind_aliases} = [qw/Maulud/];
    $r->{eng_aliases} = ["Mawlid An-Nabi"];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/religious religion=islam calendar=lunar/];
    ($r);
}
sub _h_nyepi {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Nyepi".
        ($opts->{hyear} ? " $opts->{hyear}":"");
    $r->{eng_name}    = "Nyepi".
        ($opts->{hyear} ? " $opts->{hyear}":"");
    _add_original_date($r, $opts);
    $r->{ind_aliases} = ["Tahun Baru Saka"];
    $r->{eng_aliases} = ["Bali New Year", "Bali Day Of Silence"];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/religious religion=hinduism calendar=saka/];
    ($r);
}
sub _h_goodfri {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Jum'at Agung";
    $r->{eng_name}    = "Good Friday";
    _add_original_date($r, $opts);
    $r->{ind_aliases} = ["Wafat Isa Al-Masih"];
    $r->{eng_aliases} = [];
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
}
sub _h_isramiraj {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Isra Miraj";
    $r->{eng_name}    = "Isra And Miraj";
    _add_original_date($r, $opts);
    $r->{ind_aliases} = [];
    $r->{eng_aliases} = [];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/religious religion=islam calendar=lunar/];
    ($r);
}
sub _h_eidulf {
    my ($r, $opts) = @_;
    $opts //= {};
    my $ind_name0     = "Idul Fitri".
        ($opts->{hyear} ? " $opts->{hyear}H":"");
    my $eng_name0     = "Eid Ul-Fitr".
        ($opts->{hyear} ? " $opts->{hyear}H":"");
    $r->{ind_name}    = $ind_name0.($opts->{day} ? " (Hari $opts->{day})":"");
    $r->{eng_name}    = $eng_name0.($opts->{day} ? " (Day $opts->{day})":"");
    _add_original_date($r, $opts);
    $r->{ind_aliases} = ["Lebaran"];
    $r->{eng_aliases} = [];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/religious religion=islam calendar=lunar/];
    ($r);
}
sub _h_eidula {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Idul Adha";
    $r->{eng_name}    = "Eid Al-Adha";
    _add_original_date($r, $opts);
    $r->{ind_aliases} = ["Idul Kurban"];
    $r->{eng_aliases} = [];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/religious religion=islam calendar=lunar/];
    ($r);
}
sub _h_hijra {
    my ($r, $opts) = @_;
    $opts //= {};
    $r->{ind_name}    = "Tahun Baru Hijriyah".
        ($opts->{hyear} ? " $opts->{hyear}H":"");
    $r->{eng_name}    = "Hijra".
        ($opts->{hyear} ? " $opts->{hyear}H":"");
    _add_original_date($r, $opts);
    $r->{ind_aliases} = ["1 Muharam"];
    $r->{eng_aliases} = [];
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/calendar=lunar/];
    ($r);
}
sub _h_lelection {
    my ($r, $opts) = @_;
    $r->{ind_name}    = "Pemilu Legislatif (Pileg)";
    $r->{eng_name}    = "Legislative Election";
    $r->{is_holiday}  = 1;
    $r->{tags}        = [qw/political/];
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
my $TEXT_AVAILABLE_YEARS = "Contains data from years $min_year to $max_year";
my $TEXT_WORKDAY_DEFINITION = <<'_';
Working day is defined as day that is not Saturday*/Sunday/holiday/joint leave
days*. If work_saturdays is set to true, Saturdays are also counted as working
days. If observe_joint_leaves is set to false, joint leave days are also counted
as working days.
_
    my $meta = $res->[2]{meta};
$meta->{summary} = "List Indonesian holidays in calendar";
$meta->{description} = <<"_";
List holidays and joint leave days ("cuti bersama").
$TEXT_AVAILABLE_YEARS
_
sub _check_date_arg {
    my ($date) = @_;
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
 [200, "OK", [
   {date        => '2011-02-16',
    day         => 16,
    month       => 2,
    year        => 2011,
    ind_name    => 'Maulid Nabi Muhammad',
    eng_name    => 'Mawlid',
    eng_aliases => ['Mawlid An-Nabi'],
    ind_aliases => ['Maulud'],
    is_holiday  => 1,
    tags        => [qw/religious religion=islam calendar=lunar/],
   },
   ...
 ]];
This checks whether 2011-02-16 is a holiday:
 my $res = is_idn_holiday(date => '2011-02-16');
 print "2011-02-16 is a holiday\n" if $res->[2];
This checks whether 2021-03-11 is a working day:
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
Return value:  (any)
=head2 list_idn_holidays
Usage:
 list_idn_holidays(%args) -> [$status_code, $reason, $payload, \%result_meta]
List Indonesian holidays in calendar.
List holidays and joint leave days ("cuti bersama").
Contains data from years 1990 to 2025
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
=over 4
lib/Calendar/Indonesia/Holiday.pm view on Meta::CPAN
recommend that some of these leave days be spent together nationally on certain
assigned days, especially adjacent to holidays like Eid Ul-Fitr ("Lebaran"). It
is not mandated (companies can opt to follow it or not, depending on their
specific situation), but many do follow it anyway, e.g. government civil
workers, banks, etc. I am marking joint leave days with is_joint_leave=1 and
is_holiday=0, while the holidays themselves with is_holiday=1, so you can
differentiate/select both/either one.
=head2 When was joint leave established?
Joint leave was first decreed in 2001 [1] for the 2002 & 2003 calendar years.
The 2001 calendar year does not yet have joint leave days [2]. See also [3].
Websites that list joint leave days for 2001 or earlier years (example: [4],
[5]) are incorrect; by 2001 or earlier, these joint leave days had not been
officially decreed by the government.
[1] https://jdih.kemnaker.go.id/data_wirata/2002-4-4.pdf
[2] https://peraturan.bkpm.go.id/jdih/userfiles/batang/Kepmenag_162_2000.pdf
[3] http://www.wikiapbn.org/cuti-bersama/
[4] https://kalenderindonesia.com/libur/masehi/2001
[5] https://kalenderindonesia.com/libur/masehi/1991
=head2 What happens when multiple religious/holidays coincide on a single calendar day?
For example, in 1997, both Hijra and Ascension Day fall on May 8th. When this
happens, C<ind_name> and C<eng_name> will contain all the names of the holidays
separated by comma, respectively:
 Tahun Baru Hijriah, Kenaikan Isa Al-Masih
 Hijra, Ascension Day
All the properties that have the same value will be set in the merged holiday
data:
 is_holiday => 1,
 is_joint_leave => 1,
The C<multiple> property will also be set to true:
 multiple => 1,
All the tags will be merged:
 tags => ['religious', 'religion=christianity', 'calendar=lunar']
You can get each holiday's data in the C<holidays> key.
=head2 Data for older holidays?
Will be provided if there is demand and data source.
=head2 Holidays after (current year)+1?
Some religious holidays, especially Vesakha, are not determined yet. Joint leave
( run in 1.177 second using v1.01-cache-2.11-cpan-5dc5da66d9d )