Calendar-Hijri

 view release on metacpan or  search on metacpan

lib/Calendar/Hijri.pm  view on Meta::CPAN

package Calendar::Hijri;

=head1 NAME

Calendar::Hijri - Interface to Islamic Calendar.

=head1 VERSION

Version 0.43

=cut

use 5.006;
use Data::Dumper;

use Date::Hijri::Simple;
use Moo;
use namespace::autoclean;
with 'Calendar::Plugin::Renderer';

use overload q{""} => 'as_string', fallback => 1;

$Calendar::Hijri::VERSION   = '0.43';
$Calendar::Hijri::AUTHORITY = 'cpan:MANWAR';

has year  => (is => 'rw', predicate => 1);
has month => (is => 'rw', predicate => 1);
has date  => (is => 'ro', default   => sub { Date::Hijri::Simple->new });

sub BUILD {
    my ($self) = @_;

    $self->date->validate_year($self->year)   if $self->has_year;
    $self->date->validate_month($self->month) if $self->has_month;

    unless ($self->has_year && $self->has_month) {
        $self->year($self->date->year);
        $self->month($self->date->month);
    }
}

=head1 DESCRIPTION

Hijri Calendar begins with the migration from Mecca to Medina of Mohammad (pbuh),
the Prophet of Islam, an event  known  as the Hegira. The initials A.H.  before a
date mean "anno Hegirae" or "after Hegira". The  first  day  of the year is fixed
in the Quran as the first day of the month of Muharram.In 17 AH Umar I,the second
caliph, established the beginning of the era of the Hegira ( 1 Muharram 1 AH ) as
the date that is 16 July 622 CE in the Julian Calendar.

The years are lunar & consist of 12 lunar months. There is no intercalary period,
since the Quran ( Sura IX, verses 36,37 )  sets  the calendar year  at 12 months.
Because the year in the Hijri  calendar is shorter than a solar year, the  months
drift with respect to the seasons, in a cycle 32.50 years.

    +--------------------------------------------------------------------------------------------------------+
    |                                       Sha'aban        [1436 BE]                                        |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |      al-Ahad |   al-Ithnayn | ath-Thulatha |     al-Arbia |    al-Khamis |    al-Jumuah |      as-Sabt |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |                                            |            1 |            2 |            3 |            4 |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |            5 |            6 |            7 |            8 |            9 |           10 |           11 |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |           12 |           13 |           14 |           15 |           16 |           17 |           18 |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |           19 |           20 |           21 |           22 |           23 |           24 |           25 |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+
    |           26 |           27 |           28 |           29 |                                            |
    +--------------+--------------+--------------+--------------+--------------+--------------+--------------+

The package L<App::calendr> provides command line tool  C<calendr> to display the
supported calendars on the terminal.

=head1 SYNOPSIS

    use strict; use warnings;
    use Calendar::Hijri;



( run in 0.998 second using v1.01-cache-2.11-cpan-364913b4093 )