view release on metacpan or search on metacpan
lib/Date/DayOfWeek.pm view on Meta::CPAN
  use Date::DayOfWeek;
  $dow = dayofweek( 25, 10, 1971 ); # dd, mm, yyyy
=head1 DESCRIPTION
Calculates the day of the week for any date in the Gregorian calendar
(1563 and following).
Based on the Doomsday algorithm of John Conway.
=cut
lib/Date/DayOfWeek.pm view on Meta::CPAN
    Nails.pm as examples of the strange things that people believe - or
    believed a few hundred years ago, with regard to days of the week.
    Revision 1.15  2001/06/06 02:29:14  rbowen
    Added some more doomsday tests. Removed dayofweek tests that referred
    to years before the Gregorian calendar. Extended the range of
    Doomsday.pm indefinately into the future. And a small bug fix in
    DayOfWeek.pm
    Revision 1.14  2001/06/06 01:41:45  rbowen
    Made the calculation a little more elegant, if somewhat less
view release on metacpan or search on metacpan
lib/Date/Discordian.pm view on Meta::CPAN
follow the Discordian calendrical rhythm. Perhaps this is just because
everything sucks all of the time, but it seems to be a little deeper
than this.
You can find out more about the Discordian Calendar at
http://jubal.westnet.com/hyperdiscordia/discordian_calendar.html
and at a plethora of other sites on the Internet.
It is related to the Principia Discordia 
(http://members.xoom.com/ffungo/titlepage.html)
and the "religion" of Discordianism. I suppose that there are people
lib/Date/Discordian.pm view on Meta::CPAN
Reefknot (www.reefknot.org)
datetime@perl.org (http://lists.perl.org/showlist.cgi?name=datetime)
Calendrical Calculations, by Reingold and Dershowitz. Not that it has
anything to do with this calendar, but it is a great resource if you are
interested in algorithmic calendars. And, on that same note, the Oxford
Companion to the Year is a wonderful book too.
=cut
#}}}
view release on metacpan or search on metacpan
lib/Date/Easter.pm view on Meta::CPAN
=head2 julian_easter
    ( $month, $day ) = julian_easter( $year );
Returns the month and day of easter in the given year, in the Julian
calendar.
=cut
sub julian_easter {
    my ($year) = @_;
lib/Date/Easter.pm view on Meta::CPAN
=head2 gregorian_easter
    ( $month, $day ) = gregorian_easter( $year );
Returns the month and day of easter in the given year, in the
Gregorian calendar, which is what most of the world uses.
=cut
sub gregorian_easter {
    my ($year) = @_;
lib/Date/Easter.pm view on Meta::CPAN
=head2 easter
    ( $month, $day ) = easter( $year );
Returns the month and day of easter in the given year, in the
Gregorian calendar, which is what most of the world uses.
=cut
sub easter { return gregorian_easter(@_); }
lib/Date/Easter.pm view on Meta::CPAN
=head2 orthodox_easter
    ( $month, $day ) = orthodox_easter( $year );
Returns the month and day of easter in the given year, in the
Orthodox calendar.
From code by Pascalis Ligdas, based on original code by
Apostolos Syropoulos
=cut
sub orthodox_easter {
    my $year   = shift;
    die "Invalid year for Gregorian calendar" if ($year < 1583);
    # Find the date of the Paschal Full Moon (based on Alexandrian computus)
    my $epact = ( ( $year % 19 ) * 11 ) % 30;
    my $fullmoon = 5 - $epact;
    $fullmoon += 30 if $fullmoon < -10;
lib/Date/Easter.pm view on Meta::CPAN
Rich Bowen <rbowen@rcbowen.com>
=head1 To Do
Since the dates that various countries switched to the Gregorian
calendar vary greatly, it's hard to figure out when to use
which method. Perhaps some sort of locale checking would be
cool?
I need to test the Julian easter calculations, but I'm a little
confused as to the difference between the Orthodox Easter and the
view release on metacpan or search on metacpan
lib/Date/Ethiopic.pm view on Meta::CPAN
#
# calscale and toGregorian and are methods I recommend every non-Gregorian
# based ICal package provide to identify itself and to convert the
# calendar system it handles into a normalized form.
#
sub calscale
{
	"ethiopic";
}
lib/Date/Ethiopic.pm view on Meta::CPAN
 #
 my $grego = new Date::ICal ( ical => '20030308' );
 $ethio = new Date::Ethiopic ( $grego );
 #
 #  get a Date::ICal object in the Gregorian calendar system
 #
 $grego = $ethio->toGregorian;  
=head1 DESCRIPTION
The Date::Ethiopic module provides methods for accessing date information
in the Ethiopic calendar system.  The module will also convert dates to
and from the Gregorian system.
=head2 Limitations
In the Gregorian system the rule for adding a 29th day to February during
leap year follows as per;  February will have a 29th day:
(((((every 4 years) except every 100 years) except every 400 years) except every 2,000) except (maybe every 16,000 years))
The Ethiopic calendar gets an extra day at the end of the 13th month on leap
year (which occurs the year before Gregorian leap year).
It is not known however if the Ethiopic calendar follows the 2,000 year rule.
If it does NOT follow the 2,000 year rule the consequence would be that the
difference between the two calendar systems will increase by a single day.
Hence if you reckon your birthday in the Ethiopic system, that date in
Gregorian may change in five years.  The algorithm here here assumes that
the Ethiopic system will follow the 2,000 year rule.
This may however become a moot point when we consider:
lib/Date/Ethiopic.pm view on Meta::CPAN
=head2 The Impending Calamity at the End of Time
Well, it is more of a major reset.  Recent reports from reliable sources
indicate that every
1,000 years the Ethiopic calendar goes thru a major upheaval whereby
the calendar gets resyncronized with either September 1st or possibly
even October 1st.  Accordingly Nehasse would then either end on the 25th
day or Pagumen would be extend to 25 days.  Noone will know their birthday
any more, Christmas or any other date that ever once had meaning.  Chaos
will indeed rule the world.
Unless everyone gets little calendar converting applets running on their wrist
watches, that would rule.  But before you start coding applets for future
embeded systems, lets get this clarified.  Consider that the Gregorian
calendar system is less than 500 years old, so this couldn't have happend
a 1,000 years ago, perhaps with the Julian calendar.  Since the Ethiopic
calendar is still in sync with the Coptic, the Copts must have gone thru
the same upheaval.
We are following this story closely, stay tuned to these man pages
for updates as they come in.
=head1 CREDITS
=over 4
=item * Calendrical Calculations: L<http://www.calendarists.com/>
=item * Bahra Hasab: L<http://www.hmml.org/events/>
=item * LibEth: L<http://libeth.sourceforge.net/>
view release on metacpan or search on metacpan
0.07  Tue Aug 02 11:45:00 2016
      - Updated the dependency on Date::Utils v0.21.
0.06  Sun Jul 17 10:20:00 2016
      - Updated the dependency on Date::Utils v0.20.
      - Dropped method get_calendar() as it's no longer relevant here.
0.05  Sat May 14 05:00:00 2016
      - Updated the dependency on Date::Utils v0.18.
      - Updated method get_calendar() and method as_string() to use get_month_name().
      - Renamed method gregorian_months() to months().
      - Renamed method gregorian_days() to days().
      - Updated method get_calendar() to respect the above changes.
0.04  Mon Apr 25 11:20:00 2016
      - Updated the dependency on Date::Utils v0.16.
      - Added section "SEE ALSO".
view release on metacpan or search on metacpan
lib/Date/Gregorian.pm view on Meta::CPAN
=encoding utf8
=head1 NAME
Date::Gregorian - Gregorian calendar
=head1 VERSION
This documentation refers to version 0.13 of Date::Gregorian.
lib/Date/Gregorian.pm view on Meta::CPAN
  $date2->set_ymd(1917, 10, 25);      # pre-Gregorian Oct 25, 1917
  $date->set_date($date2);            # Gregorian Nov 7, 1917 (same day)
  if ($date->is_gregorian) {
    # date is past configured calendar reformation,
    # thus in Gregorian notation
  }
  else {
    # date is before configured calendar reformation,
    # thus in Julian notation
  }
  # get the first sunday in October:
  $date->set_ymd($year, 10,  1)->set_weekday(6, '>=');
lib/Date/Gregorian.pm view on Meta::CPAN
  $date->truncate_to_day;
=head1 DESCRIPTION
Calendars define some notation to identify days in history.  The
Gregorian calendar, now in wide use, was established by Pope
Gregory XIII in AD 1582 as an improvement over the less accurate
Julian calendar that had been in use before.  Both of these calendars
also determine certain holidays.  Unfortunately, the new one was
not adopted everywhere at the same time.  Thus, the correct date
for a given historic event can depend on its location.  Astronomers
usually expand the official Julian/Gregorian calendar backwards
beyond AD 1 using zero and negative numbers, so that year 0 is
1 BC, year -1 is 2 BC, etc.
This module provides an object class representing days in history.
You can get earlier or later dates by way of adding days to them,
determine the difference in days between two of them, and read out
the day, month and year number as the (astronomic) Gregorian calendar
defines them (numbers 1 through 12 representing January through
December).  Moreover, you can find out weekdays, easter sundays,
week in year and day in year numbers.
For convenience, it is also possible to define the switching day
from Julian to Gregorian dates and the switching year from
pre-Gregorian to Gregorian easter schedule.  Use configure with
the first valid date of the new calendar and optionally the first
year the new easter schedule was used (default 1583).
The module is based on an algorithm devised by C. F. Gauss (1777-1855).
It is completely written in Perl for maximum portability.
lib/Date/Gregorian.pm view on Meta::CPAN
more efficient than the former.  I<new> does not take any arguments.
=head2 set_date
I<set_date> sets one Date::Gregorian object to the same day another
object represents.  The objects do not need to share a common calendar
configuration.
=head2 set_ymd
I<set_ymd> sets year, month and day to new absolute values.  Days
lib/Date/Gregorian.pm view on Meta::CPAN
and the object itself is returned, evaluating to true in boolean
context.  Otherwise, the object remains untouched and B<undef> is
returned.
Note that year 1582 (or whatever year was configured to have the
Gregorian calendar reformation) was considerably shorter than a
normal year.  Such a year has some invalid dates that otherwise
might seem utterly inconspicuos.
=head2 add_days
lib/Date/Gregorian.pm view on Meta::CPAN
(independent of the year stored in the date object, but taking
into account its configuration).
=head2 configure
I<configure> defines the way the Gregorian calendar reformation
should be handled in calculations with the date object and any new
ones later cloned with I<new> from this one.  The first three
arguments specify the year, month and day of the first day the new
calendar was in use.  The optional fourth argument defines the first
year the new easter schedule has to be used in easter calculations.
Re-configuring a date object is legal and does not change the day
in history it represents while possibly changing the year, month
and day values related to it.
=head2 is_gregorian
I<is_gregorian> returns a boolean value telling whether a date is
past the configured calendar reformation and thus will yield year,
month and day values in Gregorian mode.
=head2 get_string
I<get_string> returns a plaintext representation of the date represented
lib/Date/Gregorian.pm view on Meta::CPAN
=head2 DateTime interoperability
Date::Gregorian objects can be converted to DateTime objects and
vice versa.  From the view of DateTime, Date::Gregorian implements
a calendar operating in the floating timezone.  From the view of
Date::Gregorian, DateTime objects represent days in history in a
way suitable for object initialization.  Higher precision
components of DateTime objects, i.e. seconds and nanoseconds,
are preserved for reverse conversion but otherwise ignored.
lib/Date/Gregorian.pm view on Meta::CPAN
Add time arguments to gmtime and localtime conversions.
=item *
Add more business calendars.
=item *
Name days and holidays.
view release on metacpan or search on metacpan
0.15  Thu Aug 04 12:10:00 2016
      - Updated the dependency on Date::Utils v0.21.
0.14  Tue Jul 19 11:30:00 2016
      - Dropped method get_calendar() as it's no longer relevant here.
      - Updated copyright year information in README file.
0.13  Thu May 26 10:35:00 2016
      - Fixed missing pre-reqs as reported by CPANTS.
      - Updated the dependency on Date::Utils v0.20.
      - Removed commented lines of code.
0.12  Tue May 17 10:35:00 2016
      - Updated the dependency on Date::Utils v0.19.
      - Updated method get_calendar() and method as_string() to use get_month_name().
      - Renamed method hijri_months() to months().
      - Renamed method hijri_days() to days().
      - Updated method get_calendar() to respect the above changes.
0.11  Sun Apr 24 11:20:00 2016
      - Updated the dependency on Date::Utils v0.16.
0.10  Thu Mar 17 16:25:00 2016
      - Added the dependency on Date::Utils v0.11.
      - Updated method validate_day() to make use of Date::Exception package.
0.08  Thu Jul 16 04:35:00 2015
      - Added the dependency on Date::Utils v0.10.
      - Added method get_calendar().
0.07  Sat Jul 04 20:00:00 2015
      - Added the dependency on Date::Utils v0.09.
      - Updated sample code in the section "SYNOPSIS".
view release on metacpan or search on metacpan
lib/Date/HijriDate.pm view on Meta::CPAN
								'ar' => ["Ù
ØØ±Ù
","ØµÙØ±","Ø±Ø¨ÙØ¹ Ø§ÙØ£ÙÙ","Ø±Ø¨ÙØ¹ Ø§ÙØ«Ø§ÙÙ", "جÙ
Ø§Ø¯Ù Ø§ÙØ£ÙÙ","جÙ
Ø§Ø¯Ù Ø§ÙØ«Ø§ÙÙ",
												"رجب","شعباÙ", "رÙ
ضاÙ","Ø´ÙØ§Ù","ذ٠اÙÙØ¹Ø¯Ø©","Ø°Ù Ø§ÙØØ¬Ø©"]
							);
#=========================================================#
	#Arithmetical calendar type 	  
	#Ic [â15â, civil] 	  				 
	#Ia [â15â, astronomical] 	  				 
	#IIc [â16â, civil] 	  				 
	#IIa [â16â, astronomical = âMS HijriCalendarâ] 	  				 
	#IIIc [FÄtimid, civil] 	  				 
lib/Date/HijriDate.pm view on Meta::CPAN
	if ($m < 3) {
		$y -= 1;
		$m += 12;
	}
	# determine offset between Julian and Gregorian calendar 
	my $jgc;
	if ($y < 1583) {$jgc = 0};
	if ($y == 1582) {
		if ($m > 10) {$jgc = 10;}
lib/Date/HijriDate.pm view on Meta::CPAN
	# compute Chronological Julian Day Number (CJDN)
  
	my $cjdn = floor(365.25*($y + 4716)) + floor(30.6001*($m+1)) + $day - $jgc - 1524;
	# output calendar type (0 = Julian; 1 = Gregorian)
  
	if ($cjdn < 2299161) {
		$jgc = 0;
		$ret{caltype} = 0;
	}
lib/Date/HijriDate.pm view on Meta::CPAN
	}
	$month -= 1;
	$year = $c - 4716;
	# output Western calendar date
	$ret{day} = $day;
	$ret{month} = $month - 1;
	$ret{year} = $year;
	# compute weekday
lib/Date/HijriDate.pm view on Meta::CPAN
	
	my $iyear = 10631/30;
	my $epochastro = 1948084;
	my $epochcivil = 1948085;
	# compute and output Islamic calendar date (type I)
  
	my $shift1 = 8.01/60; # rets in years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 & 29 as leap years
  
	my $z = $cjdn - $epochcivil;
	my $cyc = floor($z/10631);
lib/Date/HijriDate.pm view on Meta::CPAN
	$ret{iday2} = $id;
	$ret{imonth2} = $im - 1;
	$ret{iyear2} = $iy;
	$ret{iname2}  = $month{$lang}->[$im - 1];
	#compute and output Islamic calendar date (type II)   
	my $shift2 = 6.01/60; # rets in years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26 & 29 as leap years
	$z = $cjdn - $epochcivil;
	$cyc = floor($z/10631);
lib/Date/HijriDate.pm view on Meta::CPAN
	$ret{iday4} = $id;
	$ret{imonth4} = $im - 1;
	$ret{iyear4} = $iy;
	$ret{iname4}  = $month{$lang}->[$im - 1];
	# compute and output Islamic calendar date (type III)   
	my $shift3 = 0.01/60; # rets in years 2, 5, 8, 10, 13, 16, 19, 21, 24, 27 & 29 as leap years
	$z = $cjdn - $epochcivil;
	$cyc = floor($z/10631);
lib/Date/HijriDate.pm view on Meta::CPAN
  	$ret{iday6} = $id;
	$ret{imonth6} = $im - 1;
	$ret{iyear6} = $iy;
	$ret{iname6}  = $month{$lang}->[$im - 1];
	# compute and output Islamic calendar date (type IV)   
  
	my $shift4 = -2.01/60;	# rets in years 2, 5, 8, 11, 13, 16, 19, 21, 24, 27 & 30 as leap years
	$z = $cjdn - $epochcivil;
	$cyc = floor($z/10631);
lib/Date/HijriDate.pm view on Meta::CPAN
	# Western date
	$ret{month}++; # returned month 0..11
	print "Western date: $ret{day}-$ret{month}-$ret{year}\n";
	
	#Arithmetical calendar type 	  	day 	month 	year (AH) 	 
	print "'Arithmetical calendar type'	day	month	'year (AH)'	'month name'\n";
	
	# all returned month 0..11
	#Method 1 civil, astronomical
	$ret{imonth1}++; $ret{imonth2}++;
lib/Date/HijriDate.pm view on Meta::CPAN
	}
	
	# output
	Western date: 9-12-2013
	'Arithmetical calendar type'	day-month-'year (AH)'	'month name'	
	Ic [15, civil]		5-2-1435	Safar
	Ia [15, astronomical]	6-2-1435	Safar
	IIc [16, civil]	5-2-1435	Safar
	IIa [16, astronomical='MS HijriCalendar']	6-2-1435	Safar
	IIIc [FÄtimid, civil]	5-2-1435	Safar
lib/Date/HijriDate.pm view on Meta::CPAN
=head1 DESCRIPTION
This module calculates Islamic Hijri calender dates using civil and astronomical 8 methods.
	Arithmetical calendar type:
	Ic [15, civil]
	Ia [15, astronomical]
	IIc [16, civil]
	IIa [16, astronomical = "MS HijriCalendar"]
	IIIc [FÄtimid, civil]
view release on metacpan or search on metacpan
lib/Date/HolidayParser/iCalendar.pm view on Meta::CPAN
	# Generate the UID of the event, this is simply a 
	my $sum = unpack('%32C*', $name);
	# This should be unique enough for our needs.
	# We don't want it to be random, because if someone copies the events to their
	# own calendar, we want DP::iCalendar::Manager to fetch the information from
	# the changed calendar, instead of from the HolidayParser object.
	my $UID = 'D-HP-ICS-'.$FinalYDay.'-'.$PosixYear.'-'.$sum;
	
	$self->_UID_List->{$UID} = {
		UID => $UID,
		DTSTART => iCal_ConvertFromUnixTime($unixtime),
view release on metacpan or search on metacpan
lib/Date/Holidays/Abstract.pm view on Meta::CPAN
=back
The return value from is holiday is either a 1 or 0 indicating true of
false, indicating whether the specified date is a holiday in the given
country's national calendar.
Additional arguments are at the courtesy of the author of the using
module/class.
=head2 holidays
view release on metacpan or search on metacpan
lib/Date/Holidays/BY.pm view on Meta::CPAN
=cut
=head1 DESCRIPTION
Date::Holidays::BY provides functions to check if a given date is a public holiday in Belarus. This module follows the standard holiday calendar observed in Belarus, including both national holidays and specific religious observances recognized in th...
Imports nothing by default.
=cut
view release on metacpan or search on metacpan
lib/Date/Holidays/CA.pm view on Meta::CPAN
    unless (defined $self) {
        $self = Date::Holidays::CA->new($options);
    }
    my $calendar = $self->_generate_calendar($year);
    # assumption: there is only one holiday for any given day.
    while (my ($holiday_name, $holiday_dt) = each %$calendar) {
        if ($month == $holiday_dt->month and $day == $holiday_dt->day) {
            return $holiday_name;
        }
    }
lib/Date/Holidays/CA.pm view on Meta::CPAN
}
sub holidays {
    my $calendar = holidays_dt(@_);
    my %holidays = map {
       $calendar->{$_}->strftime('%m%d') => $_
    } keys %$calendar;
    return \%holidays;
}
lib/Date/Holidays/CA.pm view on Meta::CPAN
    unless (defined $self) {
        $self = Date::Holidays::CA->new($args_ref);
    }
    return $self->_generate_calendar($year);
}
### internal functions
lib/Date/Holidays/CA.pm view on Meta::CPAN
            \&_christmas_day,            'Christmas Day', 'Noël',
    ],
);
# _generate_calendar
#
# accepts: numeric year
# returns: hashref (string $holiday_name => DateTime $holiday_dt)
#
# generate a holiday calendar for the specified year -- a hash mapping
# holiday names to datetime objects.
sub _generate_calendar {
    my $self = shift;
    my $year = shift;
    my $calendar = {};
    my @holiday_list = @{ $HOLIDAYS_FOR{$self->{'province'}} };
    while(@holiday_list) {
        my $holiday_dt = (shift @holiday_list)->($year);  # fn invokation
lib/Date/Holidays/CA.pm view on Meta::CPAN
            : $self->{'language'} eq 'FR'    ? $name_fr
            : $self->{'language'} eq 'EN/FR' ? "$name_en/$name_fr"
            : $self->{'language'} eq 'FR/EN' ? "$name_fr/$name_en"
            : "$name_en/$name_fr";  # sane default, should never get here
        $calendar->{$holiday_name} = $holiday_dt;
    }
    return $calendar;
}
### toolkit functions
# _nth_monday
lib/Date/Holidays/CA.pm view on Meta::CPAN
    $year  += 1900;
    $month += 1;
    print 'Woot!' if is_holiday($year, $month, $day, {province => 'BC'});
    my $calendar = holidays($year, {province => 'BC'});
    #returns a hash reference
    print $calendar->{'0701'};              # "Canada Day/Fête du Canada"
    # object-oriented approach
    use DateTime;
lib/Date/Holidays/CA.pm view on Meta::CPAN
    my $dhc = Date::Holidays::CA->new({ province => 'QC' });
    print 'Woot!' if $dhc->is_holiday(DateTime->today);
    my $calendar = $dhc->holidays_dt(DateTime->today->year);
    print join keys %$calendar, "\n";       # lists holiday names for QC
=head1 DESCRIPTION
Date::Holidays::CA determines public holidays for Canadian jurisdictions.
Its interface is a superset of that provided by Date::Holidays -- read
lib/Date/Holidays/CA.pm view on Meta::CPAN
For the given year, return a hashref containing all the holidays for
that year.  The keys are the date of the holiday in C<mmdd> format
(eg '1225' for December 25); the values are the holiday names.
    my $calendar = holidays($year, {province => 'MB', language => 'EN'});
    #returns a hash reference
    print $calendar->{'0701'};               # "Canada Day"
    my $calendar = $dhc->holidays($year);
    #returns a hash reference
    print $calendar->{'1111'};               # "Remembrance Day"
=head3 ca_holidays()
Same as C<holidays()>.
=head3 holidays_dt()
Similar to C<holidays()>, after a fashion: returns a hashref with the
holiday names as the keys and DateTime objects as the values.
    my $calendar = $dhc->holidays_dt($year);
=head1 SPECIFICATIONS
The following holidays are recognized:
view release on metacpan or search on metacpan
lib/Date/Holidays/CN.pm view on Meta::CPAN
use DateTime;
use DateTime::Calendar::Chinese;
use Time::Local;
# The Gregorian calendar/solar calendar
my $SOLAR = {
	'0101' => 'å
æ¦',
	'0214' => 'æ
人è',
	'0308' => 'å¦å¥³è',
	'0312' => 'æ¤æ è',
lib/Date/Holidays/CN.pm view on Meta::CPAN
	'0910' => 'æå¸è',
	'1001' => 'å½åºè',
	'1225' => 'å£è¯è',
};	
# The Chinese calendar/lunar calendar
my $LUNAR = {
	'0101' => 'æ¥è',
	'0115' => 'å
宵è',
	'0505' => '端åè',
	'0707' => 'ä¸å¤æ
人è',
lib/Date/Holidays/CN.pm view on Meta::CPAN
sub cn_holidays {
	my ($year) = @_;
	defined $year  || return undef;
	# only provide solar calendar for now
	return $SOLAR;
}
1;
__END__
lib/Date/Holidays/CN.pm view on Meta::CPAN
determine whether that day is a Chinese holiday
=head2 cn_holidays($year)
BE CAREFUL! It only provide solar calendar for now! And it's not suggested!
=head1 EXPORT_OK
SUGGESTED! quicker and more elegant!
=head2 is_cn_solar_holiday( $year, $month, $day )
determine whether that day is a Chinese holiday by the Gregorian calendar/solar calendar
=head2 is_cn_lunar_holiday( $year, $month, $day )
determine whether that day is a Chinese holiday by the Chinese calendar/lunar calendar
=head1 RETURN VALUE
if it is a holiday, return the Chinese holiday name(utf8), otherwise return undef.
view release on metacpan or search on metacpan
Determines whether a given date is a Danish public holiday or not.
This module is based on the simple API of Date::Holidays::UK, but
implements a generalised date mechanism, that will work for all
years since 1700, when Denmark adopted the Gregorian calendar.
=head1 Functions
=over 4
view release on metacpan or search on metacpan
lib/Date/Holidays/KZ.pm view on Meta::CPAN
    },
    {
        name => 'ÐÐµÐ½Ñ ÐезавиÑимоÑÑи',
        days => [ qw( 1216 1217 ) ],
    },
    # ÐÑÑбан-айÑа goes to HOLIDAYS_SPECIAL because based on the muslim calendar
);
my %HOLIDAYS_SPECIAL = (
    2016 => [ qw( 0104 0307 0502 0510 0912 1219 ) ],
    2017 => [ qw( 0103 0320 0508 0707 0901 1218 1219 ) ],
view release on metacpan or search on metacpan
lib/Date/Holidays/NYSE.pm view on Meta::CPAN
=head1 DESCRIPTION
Date::Holidays Adapter for New York Stock Exchange (NYSE) holidays
Per https://www.nyse.com/markets/hours-calendars these are the NYSE holidays.
  New Years Day (not observed on 12/31)
  Martin Luther King, Jr. Day
  Washington's Birthday
  Good Friday (falls between March 20 and April 23)
lib/Date/Holidays/NYSE.pm view on Meta::CPAN
    if ($year == $year_good_friday and $month == $month_good_friday and $day == $day_good_friday) {
      $is_good_friday = 1;
    }
  }
  #Ref: https://www.nyse.com/markets/hours-calendars
  #Ref: https://web.archive.org/web/20101203013357/http://www.nyse.com/about/newsevents/1176373643795.html
  #Friday 12/31 - New Years' Day (January 1) in 2011 falls on a Saturday. The rules of the applicable exchanges state that when a holiday falls on a Saturday, we observe the preceding Friday unless the Friday is the end of a monthly or yearly account...
  if ($month == 1 and $day == 1 and $wday >= 1 and $wday <= 5) {                         #New Year's Day on a Weekday
    return q{New Year's Day};
  } elsif ($month == 1 and $day == 2 and $wday == 1) {                                   #Monday after New Year's Day
view release on metacpan or search on metacpan
lib/Date/Holidays/RU.pm view on Meta::CPAN
my $HOLIDAYS_VALID_SINCE = 1991;
#my $BUSINESS_DAYS_VALID_SINCE = 2004;
# sources:
#   http://www.consultant.ru/law/ref/calendar/proizvodstvennye/
#   http://ru.wikipedia.org/wiki/ÐÑÑоÑиÑ_пÑаздников_РоÑÑии
#   http://www.consultant.ru/popular/kzot/54_6.html#p530
#   http://www.consultant.ru/document/cons_doc_LAW_127924/?frame=17#p1681
my @REGULAR_HOLIDAYS = (
view release on metacpan or search on metacpan
lib/Date/Holidays/Super.pm view on Meta::CPAN
=back
The return value from is holiday is either a 1 or 0 indicating true of
false, indicating whether the specified date is a holiday in the given
country's national calendar.
B<is_holiday> in the SUPER class returns 0 indicating false, since
nothing intelligent can be said about holidays without specifying a
national calendar.
Additional arguments are at the courtesy of the author of the using
module/class.
=head2 holidays
lib/Date/Holidays/Super.pm view on Meta::CPAN
indicated by the day. The result set will of course vary depending on
the given country's national holiday.
B<holidays> in the SUPER class return a reference to an empty hash,
since nothing intelligent can be said about holidays without specifying
a national calendar.
Additional arguments are at the courtesy of the author of the using
module/class.
--
view release on metacpan or search on metacpan
lib/Date/Holidays/TW.pm view on Meta::CPAN
        ...
    }
=head1 DESCRIPTION
This module provides functions to look into Taiwan holiday calendars
for known holidays. It could be used by itself, or under via
L<Date::Holidays> module.
Caveat: Due to the rule of weekend-compensation and the fact that the
majority of holidays are defined by Chinese calendar (Lunar), it
requires some non-trivial amount of computation to correctly determine
whether the given date is an holiday or not -- which is not
implemented at this version.
The current implementation includes all known holidays from year 2013
lib/Date/Holidays/TW.pm view on Meta::CPAN
holidays in those years. It should also determine most of the future
holidays correctly with some basic compuation, except for the ones
generated by the weekend-compensation rules, which is somewhat
ambiguous.
Conventionally the holiday calendar for the next year is announcend at
the end of June and we could start to mix the new information into the
lookup table in this module.
Generally speaking, queries for far future should be avoided.
view release on metacpan or search on metacpan
lib/Date/Holidays/UA.pm view on Meta::CPAN
    $year  += 1900;
    $month += 1;
    print 'Holiday!' if is_holiday($year, $month, $day);
    my $calendar = holidays($year, {language => 'en'});
    print $calendar->{'0824'};
    # object-oriented approach
    use DateTime;
    use Date::Holidays::UA;
    my $ua = Date::Holidays::UA->new({ language => 'en' });
    print 'Holiday!' if $ua->is_holiday_dt(DateTime->today);
    my $calendar = $ua->holidays(DateTime->today->year);
    print join("\n", value(%$calendar)); # list of holiday names for Ukraine
=head1 SUBROUTINES/METHODS
=head2 new()
lib/Date/Holidays/UA.pm view on Meta::CPAN
    if (!defined($self)) {
        $self = __PACKAGE__->new($opt);
    }
    my $holiday_name = undef;
    my $calendar = $self->_generate_calendar($year);
    for my $holiday(@{$calendar || []}) {
        my $holiday_dt = $holiday->{dt};
        if (($holiday_dt->month == $month) && ($holiday_dt->day == $day)) {
            $holiday_name = $self->_get_holiday_name($holiday);
            last;
lib/Date/Holidays/UA.pm view on Meta::CPAN
For the given year, return a hashref containing all the holidays for
that year.  The keys are the date of the holiday in C<mmdd> format
(eg '1225' for December 25); the values are the holiday names.
    my $calendar = holidays($year, {language => 'en'});
    print $calendar->{'0824'}; # "Independence Day"
    my $calendar = $ua->holidays($year);
    print $calendar->{'0628'}; # "Constitution Day"
=cut
sub holidays {
    my $self;
lib/Date/Holidays/UA.pm view on Meta::CPAN
    unless (defined $self) {
        $self = __PACKAGE__->new($args_ref);
    }
    my $calendar = $self->_generate_calendar($year);
    my %holidays = map {
        $_->{dt}->strftime('%m%d') => $self->_get_holiday_name($_)
    }@{$calendar || []};
    return \%holidays;
}
=head2 ua_holidays()
lib/Date/Holidays/UA.pm view on Meta::CPAN
=head2 holidays_dt()
Similar to C<holidays()>, The keys are the date of the holiday in C<mmdd> format
(eg '1225' for December 25); and DateTime objects as the values.
    my $calendar = $ua->holidays_dt($year);
=cut
sub holidays_dt {
    my $self;
lib/Date/Holidays/UA.pm view on Meta::CPAN
    unless (defined $self) {
        $self = __PACKAGE__->new($args_ref);
    }
    my $calendar = $self->_generate_calendar($year);
    my %holidays = map {
        $_->{dt}->strftime('%m%d') => $_->{dt}
    }@{$calendar || []};
    return \%holidays;
}
# _get_holiday_name
#
# accepts: holiday item
# returns: holiday name
#
# generate a holiday calendar for the specified year
sub _get_holiday_name {
    my $self = shift;
    my $holiday = shift;
    croak('Missing or wrong holiday item') if (!$holiday || !keys(%{$holiday || {}}));
    my $holiday_name = (lc($self->{language}) eq lc(DEFAULT_LANG)) ? $holiday->{local_name} : $holiday->{name};
    return $holiday_name;
}
# _generate_calendar
#
# accepts: numeric year
# returns: arrayref of hashref
#
# generate a holiday calendar for the specified year
sub _generate_calendar {
    my $self = shift;
    my $year = shift;
    my $calendar = [];
    croak('Missing year parameter') if (!$year);
    for my $holiday_rule(@{${\HOLIDAY_RULES}}) {
        next if ($holiday_rule->{start_year} && ($year <= $holiday_rule->{start_year}));
lib/Date/Holidays/UA.pm view on Meta::CPAN
        if ($holiday_rule->{is_easter_depend}) {
            my $dt = DateTime->new(year => $year);
            my $easter = DateTime::Event::Easter->new(easter => "eastern");
            my $easter_offset_day = $holiday_rule->{easter_offset_day};
            push @{$calendar}, {
                name => $holiday_rule->{name},
                local_name => $holiday_rule->{local_name},
                dt => $easter->following($dt)->add(days => $easter_offset_day)
            };
        }
lib/Date/Holidays/UA.pm view on Meta::CPAN
            my $dt = DateTime->new(
                year => $year,
                month => $holiday_rule->{month},
                day => $holiday_rule->{day}
            );
            push @{$calendar}, {name => $holiday_rule->{name}, local_name => $holiday_rule->{local_name}, dt => $dt};
        }
    }
    return _spread_on_weekend($calendar);
}
# _spread_on_weekend
#
# accepts: calendar of holidays
# returns: arrayref of hashref
#
# spread weekend holidays on other non-weekend days
sub _spread_on_weekend {
    my $calendar = shift;
    croak('Missing calendar') if (!scalar(@{$calendar || []}));
    my $calc = [];
    for my $holiday(@{$calendar || []}) {
        next if (!$holiday->{dt});
        push(@{$calc}, $holiday);
        my $dt = $holiday->{dt}->clone();
view release on metacpan or search on metacpan
lib/Date/Holidays/US.pm view on Meta::CPAN
  } elsif ($year >= 1971 and $month == 5 and $day >= 25 and $day <= 31 and $wday == 1) { #Uniform Monday Holiday Act (June 28, 1968)
    return 'Memorial Day';                                            #the last Monday in May
  #The day was first recognized as a federal holiday in June 2021, when President
  #Joe Biden signed the Juneteenth National Independence Day Act into law.
  } elsif ($year >= 2021 and $month == 6 and $day == 18 and $wday == 5) { #Executive Order 11582 (Feb. 11, 1971) "or any other calendar day designated as a holiday by Federal statute"
    return 'Juneteenth National Independence Day Observed';               #Friday before June 19
  } elsif ($year >= 2021 and $month == 6 and $day == 19) {                #Juneteenth National Independence Day Act (June 17, 2021)
    return 'Juneteenth National Independence Day';                        #June 19
  } elsif ($year >= 2021 and $month == 6 and $day == 20 and $wday == 1) { #Executive Order 11582 (Feb. 11, 1971)
    return 'Juneteenth National Independence Day Observed';               #Monday after June 19
view release on metacpan or search on metacpan
lib/Date/Holidays.pm view on Meta::CPAN
sub _check_countries {
    my ( $self, %params ) = @_;
    my $result             = {};
    my $precedent_calendar = q{};
    foreach my $country ( @{ $params{'countries'} } ) {
        #The list of countries is ordered
        if ( $country =~ m/\A[+](\w+)/xism ) {
            $country            = $1;
            $precedent_calendar = $country;
        }
        try {
            my $dh = $self->new(
                countrycode => $country,
lib/Date/Holidays.pm view on Meta::CPAN
                $prepared_parameters{state} = $params{state};
            }
            my $r = $dh->is_holiday(%prepared_parameters);
            if ( $precedent_calendar eq $country ) {
                $self->{precedent_calendar} = $dh;
            }
            # handling precedent calendar
            if (    $precedent_calendar
                and $precedent_calendar ne $country )
            {
                my $holiday = $self->{precedent_calendar}
                    ->is_holiday(%prepared_parameters);
                # our precedent calendar dictates overwrite or nullification
                if ( defined $holiday ) {
                    $r = $holiday;
                }
            }
lib/Date/Holidays.pm view on Meta::CPAN
=item * Inquire whether a certain date is a holiday in a specific country or a set of countries
=item * Inquire for a holidays for a given year for a specific country or a set of countries
=item * Overwrite/rename/suppress national holidays with your own calendar
=back
=head1 SYNOPSIS
lib/Date/Holidays.pm view on Meta::CPAN
=head1 DESCRIPTION
Date::Holidays is an adapters exposing a uniform API to a set of distributions
in the Date::Holidays::* namespace. All of these modules deliver methods and
information on national calendars, but no standardized API exist.
The distributions more or less follow a I<de> I<facto> standard (see: also the generic
adapter L<Date::Holidays::Adapter|https://metacpan.org/pod/Date::Holidays::Adapter>), but the adapters are implemented to uniform
this and Date::Holidays exposes a more readable API and at the same time it
provides an OO interface, to these diverse implementations, which primarily
lib/Date/Holidays.pm view on Meta::CPAN
either look at some of the other modules in the Date::Holidays::* namespace to get an
idea of the I<de> I<facto> standard or have a look at L<Date::Holidays::Abstract|https://metacpan.org/pod/Date::Holidays::Abstract> and
L<Date::Holidays::Super|https://metacpan.org/pod/Date::Holidays::Super> - or write me.
In addition to the adapter feature, Date::Holidays also do aggregation, so you
can combine calendars and you can overwrite and redefined existing calendars.
=head2 DEFINING YOUR OWN CALENDAR
As mentioned in the FEATURES section it is possible to create your own local calendar.
This can be done using a L<JSON|https://metacpan.org/pod/JSON> file with your local definitions:
    {
        "1501" : "jonasbn's birthday"
    }
This also mean you can overwrite your national calendar:
    {
        "1225" : ""
    }
lib/Date/Holidays.pm view on Meta::CPAN
    {
        "201.1625" : ""
    }
In order for the calendar to be picked up by Date::Holidays, set the environment variable:
    $HOLIDAYS_FILE
This should point to the JSON file.
lib/Date/Holidays.pm view on Meta::CPAN
=back
=head1 CONFIGURATION AND ENVIRONMENT
As mentioned in the section on defining your own calendar. You have to
set the environment variable:
    $HOLIDAYS_FILE
This environment variable should point to a JSON file containing holiday definitions
view release on metacpan or search on metacpan
Horoscope.pm view on Meta::CPAN
__END__
# Below is the stub of documentation for your module. You better edit it!
=head1 NAME
Date::Horoscope - Date operations based on the horoscope calendar
=head1 SYNOPSIS
#!/usr/bin/perl
view release on metacpan or search on metacpan
lib/Date/ICal.pm view on Meta::CPAN
    $ical3 = $ical - $duration;
=head1 DESCRIPTION
Date::ICal talks the ICal date format, and is intended to be a base class for
other date/calendar modules that know about ICal time format also.
=head1 AUTHOR
Rich Bowen, and the Reefknot team. Alas, Reefknot is no more. See
L<https://github.com/houseabsolute/DateTime.pm/wiki> for more modern and accurate modules.
lib/Date/ICal.pm view on Meta::CPAN
    my $ical = Date::ICal->new();
If you already have an object in Date::ICal, or some other subclass
thereof, you can create a new Date::ICal (or subclass) object using
that object to start with. This is particularly useful for converting
from one calendar to another:
   # Direct conversion from Discordian to ISO dates
   my $disco = Date::Discordian->new( disco => '12 Chaos, YOLD 3177' );
   my $iso = Date::ISO->new( $disco );
   print $iso->iso;
view release on metacpan or search on metacpan
lib/Date/ISO.pm view on Meta::CPAN
$Date: 2003/01/21 15:36:59 $
=head1 Additional comments
For more information about this calendar, please see:
http://personal.ecu.edu/mccartyr/ISOwdALG.txt
http://personal.ecu.edu/mccartyr/isowdcal.html
http://personal.ecu.edu/mccartyr/aboutwdc.htm
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
http://www.fourmilab.ch/documents/calendar/
Finally, many many many thanks to Rick McCarty who provided me with
the algorithms that I'm using for conversions to and from ISO dates.
All the errors in previous versions of this module were entirely my
fault for miscopying something from his algorithm.
view release on metacpan or search on metacpan
lib/Date/ISO8601.pm view on Meta::CPAN
=head1 NAME
Date::ISO8601 - the three ISO 8601 numerical calendars
=head1 SYNOPSIS
    use Date::ISO8601 qw(present_y);
lib/Date/ISO8601.pm view on Meta::CPAN
=head1 DESCRIPTION
The international standard ISO 8601 "Data elements and interchange formats
- Information interchange - Representation of dates and times" defines
three distinct calendars by which days can be labelled.  It also defines
textual formats for the representation of dates in these calendars.
This module provides functions to convert dates between these three
calendars and Chronological Julian Day Numbers, which is a suitable
format to do arithmetic with.  It also supplies functions that describe
the shape of these calendars, to assist in calendrical calculations.
It also supplies functions to represent dates textually in the ISO
8601 formats.  ISO 8601 also covers time of day and time periods, but
this module does nothing relating to those parts of the standard; this
is only about labelling days.
The first ISO 8601 calendar divides time up into years, months, and days.
It corresponds exactly to the Gregorian calendar, invented by Aloysius
Lilius and promulgated by Pope Gregory XIII in the late sixteenth century,
with AD (CE) year numbering.  This calendar is applied to all time,
not just to dates after its invention nor just to years 1 and later.
Thus for ancient dates it is the proleptic Gregorian calendar with
astronomical year numbering.
The second ISO 8601 calendar divides time up into the same years as
the first, but divides the year directly into days, with no months.
The standard calls this "ordinal dates".  Ordinal dates are commonly
referred to as "Julian dates", a mistake apparently deriving from true
Julian Day Numbers, which divide time up solely into linearly counted
days.
The third ISO 8601 calendar divides time up into years, weeks, and days.
The years approximate the years of the first two calendars, so they stay
in step in the long term, but the boundaries differ.  This week-based
calendar is sometimes called "the ISO calendar", apparently in the belief
that ISO 8601 does not define any other.  It is also referred to as
"business dates", because it is most used by certain businesses to whom
the week is the most important temporal cycle.
The Chronological Julian Day Number is an integral number labelling each
lib/Date/ISO8601.pm view on Meta::CPAN
digits for all year numbers (as the Long Now Foundation does), then the
right tool is C<sprintf> (see L<perlfunc/sprintf>).
This format is unconditionally conformant to all versions of ISO 8601
for years [1583, 9999].  For years [0, 1582], preceding the historical
introduction of the Gregorian calendar, it is conformant only where
it is mutually agreed that such dates (represented in the proleptic
Gregorian calendar) are acceptable.  For years outside the range [0,
9999], where the expanded format must be used, the result is only
conformant to ISO 8601:2004 (earlier versions lacked these formats),
and only where it is mutually agreed to use this format.
=cut
lib/Date/ISO8601.pm view on Meta::CPAN
	return $sign.$digits;
}
=back
=head2 Gregorian calendar
Each year is divided into twelve months, numbered [1, 12]; month number
1 is January.  Each month is divided into days, numbered sequentially
from 1.  The month lengths are irregular.  The year numbers have
unlimited range.
lib/Date/ISO8601.pm view on Meta::CPAN
=head2 Ordinal dates
Each year is divided into days, numbered sequentially from 1.  The year
lengths are irregular.  The years correspond exactly to those of the
Gregorian calendar.
=over
=item year_days(YEAR)
lib/Date/ISO8601.pm view on Meta::CPAN
	return sprintf("%s-%03d", present_y($y), _numify($d));
}
=back
=head2 Week-based calendar
Each year is divided into weeks, numbered sequentially from 1.  Each week
is divided into seven days, numbered [1, 7]; day number 1 is Monday.
The year lengths are irregular.  The year numbers have unlimited range.
The years correspond to those of the Gregorian calendar.  Each week is
associated with the Gregorian year that contains its Thursday and hence
contains the majority of its days.
=over
view release on metacpan or search on metacpan
demo/example.pl view on Meta::CPAN
  $k = $t - 50 if $t >= 57;
  $k = ($t-1) % 7 if ($t >0) & ($t <57);
  print "Karana ", $karanaid->[$k], " ends at ", hms($th{$t}), "\n";
}
# Compute traditional saka date for the gregorian calendar date.
# Takes care of inter calary months.
sub greg2saka{
   my $self = shift;
   my $sun  = $self->sun();
   my ($sr, $ss, $flag) = $self -> sunriseset();
view release on metacpan or search on metacpan
lib/Date/JD.pm view on Meta::CPAN
    # and 509 other conversion functions
=head1 DESCRIPTION
For date and time calculations it is convenient to represent dates by
a simple linear count of days, rather than in a particular calendar.
This is such a good idea that it has been invented several times.
If there were a single such linear count then it would be the obvious
data interchange format between calendar modules.  With several
versions, calendar modules can use such sensible data formats and still
have interoperability problems.  This module tackles that problem,
by performing conversions between different flavours of day count.
These day count systems are generically known as "Julian Dates", after
the most venerable of them.
lib/Date/JD.pm view on Meta::CPAN
This quantity naming pattern is derived from JD (Julian Date) and JDN
(Julian Day Number) which have the described correspondence.  Most of
the other flavours of day count listed below conventionally come in only
one of the two varieties.  The "XYZDF" name type is a neologism.
All calendar dates given are in ISO 8601 form (Gregorian calendar with
astronomical year numbering).  An hour number is appended to each date,
separated by a "T"; hour 00 is midnight at the start of the day and hour
12 is noon in the middle of the day.  An appended "Z" indicates that the
date is to be interpreted in Universal Time (the timezone of the prime
meridian), and so is absolute; where any other timezone is to be used
lib/Date/JD.pm view on Meta::CPAN
=item JD (Julian Date)
days elapsed since -4713-11-24T12Z.  This epoch is the most recent
coincidence of the first year of the Metonic cycle, indiction cycle, and
day-of-week cycle, using the Julian calendar.  It was correspondingly
named after the Julian calendar, and thus after Julius Caesar.  Some
information can be found at L<http://en.wikipedia.org/wiki/Julian_day>.
=item RJD (Reduced Julian Date)
days elapsed since 1858-11-16T12Z (JD 2400000.0).  Rarely used.
lib/Date/JD.pm view on Meta::CPAN
=item LD (Lilian Date)
days elapsed since 1582-10-14T00 in the timezone of interest (CJD
2299160.0).  This epoch is the day before the day that the Gregorian
calendar first went into use.  It is named after Aloysius Lilius, the
inventor of the Gregorian calendar.
=back
The interesting differences between these flavours are whether the
day starts at noon or at midnight, and whether they are absolute or
view release on metacpan or search on metacpan
lib/Date/Japanese/Era/Table/Builder.pm view on Meta::CPAN
=head1 DESCRIPTION
This module is used to define the conversion table used by L<Date::Japanese::Era>, unfettered by concepts such as "post-gregorian-calender", "past eras only" and "factually correct".
The module has three primary uses: The (far) past, the (far) future, and the (alternate) present, and was written as a writing aid when dealing with stories relating to future eras of Japan, although it's equally useful for quick conversion of old er...
=head1 METHODS
=over 4
view release on metacpan or search on metacpan
lib/Date/Japanese/Era.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
Date::Japanese::Era - Conversion between Japanese Era / Gregorian calendar
=head1 SYNOPSIS
  use utf8;
  use Date::Japanese::Era;
lib/Date/Japanese/Era.pm view on Meta::CPAN
  $era = Date::Japanese::Era->new("æå52å¹´");
=head1 DESCRIPTION
Date::Japanese::Era handles conversion between Japanese Era and
Gregorian calendar.
=head1 METHODS
=over 4
lib/Date/Japanese/Era.pm view on Meta::CPAN
=over 4
=item *
Currently supported era is up to 'meiji'. And before Meiji 05.12.02,
gregorius calendar was not used there, but lunar calendar was. This
module does not support lunar calendar, but gives warnings in such
cases ("In %d they didn't use gregorius calendar").
To use calendar ealier than that, see
L<DateTime::Calendar::Japanese::Era>, which is based on DateTime
framework and is more comprehensive.
=item *