Calendar-Hijri
    
    
  
  
  
view release on metacpan or search on metacpan
0.22  Sat May 07 13:10:00 2016
      - Added method as_svg() using the plugin Calendar::Plugin::Renderer.
      - Added section "SEE ALSO".
      - Updated copyright year information.
0.21  Sun Aug 30 11:30:00 2015
      - Upgraded to use Date::Hijri::Simple v0.09.
0.20  Fri Jul 17 12:40:00 2015
      - Upgraded to use Date::Hijri::Simple v0.08.
      - Making use of the method get_calendar() provided by Date::Hijri::Simple.
0.19  Wed Jul 08 09:05:00 2015
      - Upgraded to use Date::Hijri::Simple v0.07.
0.18  Wed Jul 01 10:20:00 2015
      - Fixed the pod document showing sample Hijri Calendar.
0.17  Sun Jun 28 02:05:00 2015
      - Upgraded the pre-requisite Date::Hijri::Simple v0.06.
      - Updated method _calendar() w.r.t the renamed method days_in_month_year().
0.16  Thu Jun 18 10:20:00 2015
      - Fixed the bug in the method from_gregorian().
0.15  Wed Jun 10 10:25:00 2015
      - Updated method _calendar() to validate month and year.
0.14  Mon May 25 03:05:00 2015
      - Removed the dependency on Date::Utils::Hijri.
      - Upgraded the pre-requisite Date::Hijri::Simple v0.03.
      - Fine tuned method BUILD().
      - Fine tuned method current().
      - Fine tuned method from_julian().
      - Updated method _calendar().
      - Added sample calendar to the section "SYNOPSIS".
      - Added sample code to the section "SYNOPSIS".
      - Updated pod description of method from_gregorian().
      - Removed sample code from pod document for method current().
      - Removed sample code from pod document for method from_gregorian().
      - Removed sample code from pod document for method from_julian().
0.13  Thu Apr 23 23:40:00 2015
      - Re-structured and consumed Date::Utils::Hijri as Moo Role.
0.12  Tue Apr 21 13:50:00 2015
      - Fixed the bug in the method _calendar() the last cell is empty.
0.11  Sun Apr 19 11:15:00 2015
      - Complete re-write using Moo with unit tests.
0.10  Mon Mar 16 13:30:10 2015
      - Added LICENSE file.
      - Tidied up pod document in general.
0.09  Fri Jan 16 14:55:10 2015
      - Removed SIGNATURE file.
Changes
LICENSE
MANIFEST
MANIFEST.SKIP
Makefile.PL
README
lib/Calendar/Hijri.pm
t/00-load.t
t/calendar-hijri.t
t/hijri.xml
t/fake-hijri.xml
xt/manifest.t
xt/pod.t
xt/meta-json.t
xt/meta-yml.t
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)
lib/Calendar/Hijri.pm view on Meta::CPAN
=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;
    # prints current hijri month calendar.
    print Calendar::Hijri->new, "\n";
    print Calendar::Hijri->new->current, "\n";
    # prints hijri month calendar for the first month of year 1436.
    print Calendar::Hijri->new({ month => 1, year => 1436 }), "\n";
    # prints hijri month calendar in which the given gregorian date falls in.
    print Calendar::Hijri->new->from_gregorian(2015, 1, 14), "\n";
    # prints hijri month calendar in which the given julian date falls in.
    print Calendar::Hijri->new->from_julian(2457102.5), "\n";
    # prints current month hijri calendar in SVG format.
    print Calendar::Hijri->new->as_svg;
    # prints current month hijri calendar in text format.
    print Calendar::Hijri->new->as_text;
=head1 HIJRI MONTHS
    +--------+------------------------------------------------------------------+
    | Number | Name                                                             |
    +--------+------------------------------------------------------------------+
    |   1    | Muharram                                                         |
    |   2    | Safar                                                            |
    |   3    | Rabi' al-awwal                                                   |
lib/Calendar/Hijri.pm view on Meta::CPAN
    |     al-Arbia | Wednesday                                                  |
    |    al-Khamis | Thursday                                                   |
    |    al-Jumuah | Friday                                                     |
    |      as-Sabt | Saturday                                                   |
    +--------------+------------------------------------------------------------+
=head1 METHODS
=head2 current()
Returns current month of the Hijri calendar.
=cut
sub current {
    my ($self) = @_;
    return $self->as_text($self->date->month, $self->date->year);
}
=head2 from_gregorian()
Returns Hijri month calendar in which the given gregorian date falls in.
=cut
sub from_gregorian {
    my ($self, $year, $month, $day) = @_;
    return $self->from_julian($self->date->gregorian_to_julian($year, $month, $day));
}
=head2 from_julian($julian_date)
Returns Hijri month calendar in which the given julian date falls in.
=cut
sub from_julian {
    my ($self, $julian) = @_;
    my $date = $self->date->from_julian($julian);
    return $self->as_text($date->month, $date->year);
}
=head2 as_text($month, $year)
Returns  color  coded  Hijri  calendar  for  the given C<$month> and C<$year>. If
C<$month> and C<$year> missing, it would return current calendar month.
=cut
sub as_text {
    my ($self, $month, $year) = @_;
    ($month, $year) = $self->validate_params($month, $year);
    my $date = Date::Hijri::Simple->new({ year => $year, month => $month, day => 1 });
    return $self->text_calendar(
        {
            start_index => $date->day_of_week,
            month_name  => $date->get_month_name,
            days        => $date->days_in_month_year($month, $year),
            year        => $year,
            day_names   => $date->days,
        });
}
=head2 as_svg($month, $year)
Returns calendar for the given C<$month> and C<$year> rendered  in SVG format. If
C<$month> and C<$year> missing, it would return current calendar month.
=cut
sub as_svg {
    my ($self, $month, $year) = @_;
    ($month, $year) = $self->validate_params($month, $year);
    my $date = Date::Hijri::Simple->new({ year => $year, month => $month, day => 1 });
    return $self->svg_calendar({
        start_index => $date->day_of_week,
        month_name  => $date->get_month_name,
        days        => $date->days_in_month_year($month, $year),
        year        => $year });
}
sub as_string {
    my ($self) = @_;
    return $self->as_text($self->month, $self->year);
lib/Calendar/Hijri.pm view on Meta::CPAN
=item L<Calendar::Gregorian>
=item L<Calendar::Persian>
=item L<Calendar::Saka>
=back
=head1 BUGS
Please report any bugs / feature requests to C<bug-calendar-hijri at rt.cpan.org>
or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Calendar-Hijri>.
I will be notified, and then you'll automatically be notified of progress on your
bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
    perldoc Calendar::Hijri
t/fake-hijri.xml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg height="297mm" viewBox="0 0 210 297" width="210mm" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g id="calendar" label="Calendar">
		<text fill="blue" id="month" style="font-size: 15.6320" x="22.2412" y="154.4400">Rajab</text>
		<text fill="blue" id="year" style="text-align: end; text-anchor: end; font-size: 15.6320" x="201.6000" y="154.4400">1400</text>
		<rect height="117.24" id="bounding_box" style="fill:none; stroke: blue; stroke-width: 0.5;" width="179.2" x="22.4" y="160.3800" />
		<g fill="none" id="row0_col0" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="7.8160" id="box_row0_col0" width="22.7294" x="24.0265" y="161.4966" />
			<text adjust="spacing" font-size="7.0344" id="text_row0_col0" length="18.1835" stroke="red" text-anchor="middle" x="35.3912" y="167.7494">Sun</text>
		</g>
		<g fill="none" id="row0_col1" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="7.8160" id="box_row0_col1" width="22.7294" x="49.5971" y="161.4966" />
			<text adjust="spacing" font-size="7.0344" id="text_row0_col1" length="18.1835" stroke="red" text-anchor="middle" x="60.9618" y="167.7494">Mon</text>
t/hijri.xml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg height="297mm" viewBox="0 0 210 297" width="210mm" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g id="calendar" label="Calendar">
		<text fill="blue" id="month" style="font-size: 15.6320" x="22.2412" y="154.4400">Rajab</text>
		<text fill="blue" id="year" style="text-align: end; text-anchor: end; font-size: 15.6320" x="201.6000" y="154.4400">1437</text>
		<rect height="117.24" id="bounding_box" style="fill:none; stroke: blue; stroke-width: 0.5;" width="179.2" x="22.4" y="160.3800" />
		<g fill="none" id="row0_col0" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="7.8160" id="box_row0_col0" width="22.7294" x="24.0265" y="161.4966" />
			<text adjust="spacing" font-size="7.0344" id="text_row0_col0" length="18.1835" stroke="red" text-anchor="middle" x="35.3912" y="167.7494">Sun</text>
		</g>
		<g fill="none" id="row0_col1" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="7.8160" id="box_row0_col1" width="22.7294" x="49.5971" y="161.4966" />
			<text adjust="spacing" font-size="7.0344" id="text_row0_col1" length="18.1835" stroke="red" text-anchor="middle" x="60.9618" y="167.7494">Mon</text>
( run in 1.249 second using v1.01-cache-2.11-cpan-c333fce770f )