DateTime-Indic
view release on metacpan or search on metacpan
lib/DateTime/Indic/Utils.pm view on Meta::CPAN
package DateTime::Indic::Utils;
use base 'Exporter';
use warnings;
use strict;
use Carp qw/ carp croak /;
use DateTime::Util::Calc qw/ mod revolution sin_deg /;
use POSIX qw/ ceil floor /;
use Math::Trig qw( pi pi2 atan deg2rad tan );
our @EXPORT_OK = qw/
epoch
anomalistic_year
anomalistic_month
J0
J1900
sidereal_year
sidereal_month
synodic_month
creation
ayanamsha
lunar_longitude
lunar_on_or_before
newmoon
saura_rashi
saura_varsha
solar_longitude
tithi_at_dt
/;
=head1 NAME
DateTime::Indic::Utils - Utility functions for Indian calendar calculation
=head1 VERSION
Version 0.3
=cut
our $VERSION = '0.3';
=head1 SYNOPSIS
my $dt = DateTime->now;
my $ayanamsha = ayanamsha(J1900);
my $moon = lunar_longitude($J1900);
my $d1 = DateTime::Calendar::VikramaSamvata::Gujarati->new(
varsha => 2064,
masa => 7,
paksha => 1,
tithi => 30,
);
my $d2 = DateTime::Calendar::VikramaSamvata::Gujarati->new(
varsha => 2065,
masa => 1,
paksha => 0,
tithi => 15,
);
my $bool = lunar_on_or_before($d1, $d2);
my $previous_newmoon = newmoon(J1900, 0);
my $next_newmoon = newmoon(J1900, 1);
my $sun = solar_longitude(J1900);
my $rashi = saura_rashi(J1900);
my $year = saura_varsha($dt);
my $lunar_day = tithi_at_dt($dt);
=head1 ABSTRACT
A collection of utility functions and constants helpful in creating Indian
calendars.
=head1 DESCRIPTION
Note: In this document, Sanskrit words are transliterated using the ITRANS
scheme.
These functions and constants were not included directly in
L<DateTime::Indic::Chandramana> as they are more useful stand-alone. None of
them are exported by default.
=head1 CONSTANTS
=head2 epoch
Fixed date of the beginning of the Kali Yuga.
=cut
## no critic 'ProhibitConstantPragma'
use constant epoch => -1_132_959;
=head2 anomalistic_year
Mean time from aphelion to aphelion.
=cut
use constant anomalistic_year => 1_577_917_828_000 / ( 4_320_000_000 - 387 );
=head2 anomalistic_month
Mean time from apogee to apogee with bija correction.
=cut
use constant anomalistic_month => 1_577_917_828 / ( 57_753_336 - 488_199 );
=head2 J0
The fixed (RD) date of Julian date 0
=cut
use constant J0 => -1_721_425;
=head2 J1900
The Julian date at noon on Jan 1, 1900.
=cut
use constant J1900 => 2_415_020.0;
=head2 sidereal_year
Mean length of Hindu sidereal year.
=cut
( run in 1.832 second using v1.01-cache-2.11-cpan-39bf76dae61 )