view release on metacpan or search on metacpan
lib/DateTime/Calendar/Coptic.pm view on Meta::CPAN
#
# calscale and toGregorian and are methods I recommend every non-Gregorian
# based DateTime package provide to identify itself and to convert the
# calendar system it handles into a normalized form.
#
sub calscale
{
	"coptic";
}
lib/DateTime/Calendar/Coptic.pm view on Meta::CPAN
 #  instantiate with a Gregorian date, date will be converted.
 #
 $coptic = new DateTime::Calendar::Coptic ( day => 5, month => 4, year => 2003, calscale => 'gregorian' );
 #
 #  get a DateTime object in the Gregorian calendar system
 #
 my $grego = $coptic->toGregorian;  
=head1 DESCRIPTION
The DateTime::Calendar::Coptic module provides methods for accessing date information
in the Coptic calendar system.  The module will also convert dates to
and from the Gregorian system.
=head1 CREDITS
L<http://www.copticchurch.net/easter.html>
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Discordian.pm view on Meta::CPAN
  use DateTime::Calendar::Discordian;
=head1 ABSTRACT
A module that implements the Discordian calendar made popular(?) in the
"Illuminatus!" trilogy by Robert Shea and Robert Anton Wilson and by the
Church of the SubGenius.
=cut
lib/DateTime/Calendar/Discordian.pm view on Meta::CPAN
Support for this module is provided via the datetime@perl.org email list. See
L<lists.perl.org|http://lists.perl.org/> for more details.
Please submit bugs to the L<CPAN RT system|http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime-Calendar-Discordian>
or via email at bug-datetime-calendar-discordian@rt.cpan.org.
You can also look for information at:
=over 4
view release on metacpan or search on metacpan
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
# -*- encoding: utf-8; indent-tabs-mode: nil -*-
#
# Perl DateTime extension for converting to/from the French Revolutionary calendar
# Copyright (c) 2003, 2004, 2010, 2011, 2012, 2014, 2016, 2019, 2021 Jean Forget. All rights reserved.
#
# See the license in the embedded documentation below.
#
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
}
sub set_time_zone { } # do nothing, only 'floating' allowed
# Internal functions
use constant REV_BEGINNING  => 654415; # RD value for 1 Vendémiaire I in the Revolutionary calendar
use constant NORMAL_YEAR    => 365;
use constant LEAP_YEAR      => 366;
use constant FOUR_YEARS     =>  4 * NORMAL_YEAR + 1; # one leap year every four years
use constant CENTURY        => 25 * FOUR_YEARS - 1;  # centuries aren't leap years...
use constant FOUR_CENTURIES =>  4 * CENTURY + 1;     # ...except every four centuries that are.
use constant FOUR_MILLENIA  => 10 * FOUR_CENTURIES - 1; # ...except every four millenia that are not.
# number of days between the start of the revolutionary calendar, and the
# beginning of year n - 1 as long as the equinox rule is in effect
my @YEARS_BEGINS=    (0, 365, 730, 1096, 1461, 1826, 2191, 2557, 2922, 3287, 3652,
                   4018, 4383, 4748, 5113, 5479, 5844);
sub _is_leap_year {
    my ($self, $year) = @_;
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
      $doy -= $x * FOUR_YEARS;
      $x    = int ($doy / NORMAL_YEAR);
      # The integer division above divides the 4-year period, 1461 days,
      # into 5 parts: 365, 365, 365, 365 and 1. This mathematically sound operation
      # is wrong with respect to the calendar, which needs to divide
      # into 4 parts: 365, 365, 365 and 366. Therefore the adjustment below.
      $x    = 3 if $x == 4; # last day of the 4-year period
      $y   += $x;
      $doy -= $x * NORMAL_YEAR;
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
For  your  information, the  French  word  for  a ten-year  period  is
I<décennie>.
=head2 Description
The Revolutionary calendar was in  use in France from 24 November 1793
(4 Frimaire  II) to 31  December 1805 (10  Nivôse XIV). An  attempt to
apply  the  decimal rule  (the  basis of  the  metric  system) to  the
calendar. Therefore, the week  disappeared, replaced by the décade. In
addition, all months have exactly 3 décades, no more, no less.
At first,  the year was  beginning on the  equinox of autumn,  for two
reasons.  First, the  republic had  been established  on  22 September
1792, which  happened to be the  equinox, and second,  the equinox was
the symbol of equality, the day and the night lasting exactly 12 hours
each. It  was therefore  in tune with  the republic's  motto "Liberty,
Equality, Fraternity". But  it was not practical, so  Romme proposed a
leap year rule similar to the Gregorian calendar rule.
In his book I<The French Revolution>, the XIXth century writer Thomas
Carlyle proposes these translations for the month names:
=over 4
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
= 10 hours, 1 hour = 100 minutes and 1 minute = 100 seconds.  But this
reform was put on hold after two years or so and it never reappeared.
Other reforms to decimalize the time has been proposed during the last
part of  the XIXth  Century, but these  reforms were not  applied too.
And they are irrelevant for this French Revolutionary calendar module.
=head1 METHODS
Since  the week  has been  replaced by  the décade,  the corresponding
method  names  still   are  C<decade_number>,  C<day_of_decade>,  etc.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
=back
=item * from_epoch( epoch => $epoch )
Creates a  date object from a  timestamp value. This  timestamp is the
number of seconds since the computer epoch, not the calendar epoch.
=item * now( )
Creates  a date  object that  corresponds to  the precise  instant the
method is called.
=item * from_object( object => $object, ... )
Creates a date  object by converting another object  from the DateTime
suite.  The preferred way for calendar to calendar conversion.
=item * last_day_of_month( ... )
Same as C<new>,  except that the C<day> parameter  is forbidden and is
automatically set to  the end of the month.  If the C<month> parameter
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
separator (C<:> by default).
=item * iso8601
Returns the  date and time  is a format  similar to what  ISO-8601 has
specified for the Gregorian calendar.
=item * is_leap_year
Returns a true value if the year is a leap year, false else.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
this is done for compatibility with DateTime's C<week> method.
=item * utc_rd_values
Returns the  current UTC Rata Die  days, seconds and  nanoseconds as a
3-element list.  This exists primarily to allow other calendar modules
to create objects based on the values provided by this object.
=item * jd, mjd
These  return the Julian  Day and  Modified Julian  Day, respectively.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
=item * on_date
Gives  a  few historical  events  that took  place  on  the same  date
(day+month, irrespective of the  year).  These events occur during the
period of use  of the calendar, that is, no  later than Gregorian year
1805. The  related  events either  were  located  in  France, or  were
battles in which a French army was involved.
This  method accepts  one  optional argument,  the  language. For  the
moment, only  "en" for English and  "fr" for French  are available. If
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
Equivalent to %Y-%m-%d (the ISO 8601 date format)
=item * %g
Strictly similar to  %y, since I<décades> are always  aligned with the
beginning of the year in this calendar.
=item * %G
Strictly similar to  %Y, since I<décades> are always  aligned with the
beginning of the year in this calendar.
=item * %h
Equivalent to %b.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
The year as a lowercase Roman number.
=item * %EY
The year as a uppercase Roman  number, which is the traditional way to
write years when using the French Revolutionary calendar.
=item * %z
The   time-zone  as   hour  offset   from  UTC.    Required   to  emit
RFC822-conformant dates (using "%a, %d %b %Y %H:%M:%S %z").  Since the
module does not  support time zones, this gives  silly results and you
cannot  be RFC822-conformant.  Anyway,  RFC822 requires  the Gregorian
calendar, doesn't it?
=item * %Z
The  time  zone  or  name  or abbreviation,  should  the  module  have
supported them.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
=head2 Time Zones
Only the I<floating> time zone  is supported.  Time zones were created
in  the  late  XIXth  century,  at  a  time  when  fast  communication
(railroads)  and instant  communication (electric  telegraph)  made it
necessary.  But at this time, the French Revolutionary calendar was no
longer in use.
=head2 Leap Seconds
They are not supported.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
(day of reason) in others.
In addition, the sources have several slight differences between them.
All of  them obviously include some  typos. [Annexe] is chosen  as the
reference since it is the  definitive legislative text that officially
defines names of days in  the French revolutionary calendar. This text
introduces  amendments  to  the  original calendar  set  up  by  Fabre
d'Ãglantine in [Fabre], and gives  in annex the amended calendar. When
there is  a difference between  the amended calendar and  [Fabre] with
amendments  (yes it  can happen!),  [Fabre] version  prevails. Obvious
typos  in  [Annexe] (yes  it  can  happen!)  are preserved,  with  the
exception  of accented  letters  because they  are  fuzzy rendered  in
original prints, or  cannot be printed at all at  that time on letters
in uppercase.
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
L<Date::Converter>
=head2 Other Software
F<calendar/cal-french.el>  in emacs-21.2  or later  or xemacs  21.1.8,
forked in L<https://github.com/jforget/emacs-lisp-cal-french>
=head2 Books
Quid 2001, M and D Frémy, publ. Robert Laffont
lib/DateTime/Calendar/FrenchRevolutionary.pm view on Meta::CPAN
=head2 Internet
L<https://github.com/houseabsolute/DateTime.pm/wiki>
L<http://www.faqs.org/faqs/calendars/faq/part3/>
L<https://zapatopi.net/metrictime/>
L<http://datetime.mongueurs.net/>
view release on metacpan or search on metacpan
1;
__END__
=head1 NAME
DateTime::Calendar::Hebrew - Dates in the Hebrew calendar
=head1 SYNOPSIS
  use DateTime::Calendar::Hebrew;
                                         month => 10,
                                         day   => 4 );
=head1 DESCRIPTION
C<DateTime::Calendar::Hebrew> is the implementation of the Hebrew calendar.
Read on for more details on the Hebrew calendar.
=head1 THE HEBREW (JEWISH) CALENDAR
The Hebrew/Jewish calendar is a Luni-Solar calendar. Torah Law mandates that months are Lunar. The first day of a month coincides with the new moon in Jerusalem. (In ancient times, this was determined by witnesses. Read the books in the bibliography ...
The Hebrew Calendar uses a leap-month to regulate itself to the solar seasons. There are 12 months in a regular year. Months can be 29 or 30 days long. 2 of the months (Cheshvan & Kislev) change between having 29 & 30 days, depending on the year. In ...
Now a quick note about the numbering of the months. Most people expect a new year to start with month #1. However, the Hebrew calendar has more than one new year. The year number changes in the (Northern Hemisphere) Autumn with Tishrei (month #7), bu...
Tishrei is the month in which you find the High-Holy-Days - 'Rosh HaShana' & 'Yom Kippur'.
Nissan, the Spring-new-year, commemorates the Exodus of the Ancient Israelites from Egypt. The Torah refers to months only by number, beginning with Nissan, e.g. giving the date of Yom Kippur in 'the seventh month'.
=back
I<** A NOTE ABOUT SPELLING **>
If you speak Hebrew, you may take issue with my spelling of Hebrew words. I'm sorry, I used the spelling closest to the way I pronounce it. You could call it "Brooklyn-Ashkenaz-Pronunciation", if you like.
Back to the calendar. A cycle of Hebrew years takes 19 years and is called a Machzor. In that cycle, years 3, 6, 8, 11, 14, 17 & 19 are leap years.
Days (and holidays) begin at sunset, see below for more info.
The calculations for the start and length of the year are based on a number of factors, including rules about what holidays can't be on what days of the week, and things like that. For more detailed information about the Hebrew Calendar and Hebrew-Ca...
This book is great. Besides for a complete Jewish Calendar from 1900 to 2100, it contains a 22 page discourse on the Jewish Calendar - history, calculation method, religious observances - the works.
B<Understanding the Jewish Calendar by Rabbi Nathan Bushwick. Moznaim Publishing Corporation. ISBN 0-94011-817-3>
Another excellent book. Explains the calendar, lunation cycles, torah portions and more. This has more Astronomy than any of the others.
B<Calendrical Calculations by Edward Reingold & Nachum Dershowitz. Cambridge University Press. ISBN 0-521-77167-6 or 0-521-77752-6>
This book focuses on the math of calendar conversions. I use the first edition, which is full of examples in LISP. The second edition is supposed to include examples in other languages. It covers many different calendars - not just Hebrew.  See their...
There are other books, but those are the ones I used most extensively in my Perl coding.
=head1 METHODS
	minute/second : 0 to 59
	nanosecond : 0 to 999,999,999
C<Date::Calendar::Hebrew> doesn't support timezones. It uses the floating timezone.
The days on the Hebrew calendar begin at sunset. If you want to know the Hebrew
date, accurate with regard to local sunset, see the SUNSET section below.
=item * from_object(object => $object)
This class method can be used to construct a new object from
any object that implements the C<utc_rd_values()> method.  All
C<DateTime::Calendar> modules must implement this method in order to
provide cross-calendar compatibility.
=item * set(...)
	$dt->set(
		year  => 5782,
Values are checked for validity just as they are in C<new()>.
=item * utc_rd_values
Returns the current UTC Rata Die days and seconds as a three element
list.  This exists primarily to allow other calendar modules to create
objects based on the values provided by this object. We don't support
timezones, so this is actually the local RD.
=item * utc_rd_as_seconds
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Hijri.pm view on Meta::CPAN
1;
__END__
=head1 NAME
DateTime::Calendar::Hijri - Dates in the Hijri (Islamic) calendar
=head1 SYNOPSIS
    use DateTime::Calendar::Hijri;
    $dt = DateTime::Calendar::Hijri->new( year => 1424,
lib/DateTime/Calendar/Hijri.pm view on Meta::CPAN
                                            object => $datetime_obj
                                     );
=head1 DESCRIPTION
The Hijri calendar is based on the flight of Mohammed from Mecca to
Medina in the year 622 in the Gregorian calendar. This was taken as the
start of the new calendar, which is still used in a number of Islamic
countries.
Like the Gregorian calendar, the Hijri year consists of 12 months. The
start of each month is determined by the observation of the young moon.
This means that the Hijri calendar is not predictable: it is not known
beforehand when a new month will start. Several algorithms have been
written to predict the starting days of the month, and one of them is
used by this module. The calculated dates can therefore be one or two
days off the actual dates.
lib/DateTime/Calendar/Hijri.pm view on Meta::CPAN
Creates a Hijri date from another datetime compatible object.
=item * utc_rd_values
Returns the rata die count of days. This is used to convert from a Hijri
date to another calendar
=head1 BUGS
=item *
The dates are sometimes wrong by one or two days when you convert to or
from other calendars. This can't be helped, as the Hijri calendar is
based on observations, not on an algorithm.
=item *
The functionality offered by this module is rather minimal compared to
other calendar modules within the DateTime project. This is because I am
not very familiar with the Hijri calendar, and I feel I am unable to do
it justice. If you can, and if you are willing to put some time into
improving this module, I would be glad to hand over the maintainership.
Mail me!
=back
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
=head1 DESCRIPTION
This module implements the traditional Japanese Calendar, which was used
from circa 692 A.D. to 1867 A.D. The traditional Japanese Calendar is a
I<lunisolar calendar> based on the Chinese Calendar, and therefore
this module may *not* be used for handling or formatting modern Japanese
calendars which are Gregorian Calendars with a twist.
Please use DateTime::Format::Japanese for that purpose.
On top of the lunisolar calendar, this module implements a simple time
system used in the Edo period, which is a type of temporal hour system, 
based on sunrise and sunset.
=head1 CAVEATS/DISCLAIMERS
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
Help is much appreciated to rectify this :)
=head2 CALENDAR "VERSION"
Note that for each of these calendars there exist numerous different
versions/revisions. The Japanese Calendar has at least 6 different
revisions.
The Japanese Calendar that is implemented here uses the algorithm described
in the book "Calendrical Computations" [1], which presumably describes the
latest incarnation of these calendars.
=head2 ERA DISCREPANCIES FROM MODERN JAPANESE DATES
Even though this module can handle modern dates, note that this module
creates dates in the *traditional* calendar, NOT the modern gregorian
calendar used in Japane since the Meiji era. Yet, we must honor the gregorian
date in which an era started or ended. This means that the era year
calculations could be off from what you'd expect on a modern calendar.
For example, the Heisei era starts on 08 Jan 1989 (Gregorian), so in a 
modern calendar you would expect the rest of year 1989 to be Heisei 1.
However, the Chinese New Year happens to fall on 06 Feb 1989. Thus
this module would see that and increment the era year by one on that
date.
If you want to express modern Japanese calendars, you will need to use
L<DateTime::Format::Japanese> module on the vanilla DateTime object. 
(As of this writing DateTime::Format::Japanese is in alpha release. Use
at your own peril)
=head2 TIME COMPONENTS
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
Sets DateTime components.
=head2 utc_rd_values
Returns the current UTC Rata Die days, seconds, and nanoseconds as a three
element list. This exists primarily to allow other calendar modules to create
objects based on the values provided by this object.
=head2 cycle
Returns the current cycle. See L<DateTime::Calendar::Chinese>
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
Returns the current cycle_year. See L<DateTime::Calendar::Chinese>
=head2 era
Returns the DateTime::Calendar::Japanese::Era object associated with this
calendar.
=head2 era_name
Returns the name (id) of the DateTime::Calendar::Japanese::Era object
associated with this calendar.
=head2 era_year
Returns the number of years in the current era, as calculated by the
traditional lunisolar calendar. Note that calculations will be different
from those based on the modern calendar, as the date of New Year (which is
when era years are incremented) differ from modern calendars. For example,
based on the traditional calendar, SHOUWA3 (1926 - 1989) had only 63 years,
not 64. See L<CAVEATS|/ERA DISCREPANCIES FROM MODERN JAPANESE DATES>
=head2 hour
Returns the hour, based on the traditional Japanese time system. The
lib/DateTime/Calendar/Japanese.pm view on Meta::CPAN
  [1] Edward M. Reingold, Nachum Dershowitz
      "Calendrical Calculations (Millenium Edition)", 2nd ed.
       Cambridge University Press, Cambridge, UK 2002
  [2] http://homepage2.nifty.com/o-tajima/rekidaso/calendar.htm
  [3] http://www.tanomi.com/shop/items/wa_watch/index2.html
  [4] http://www.geocities.co.jp/Playtown/6757/edojikan01.html
  [5] http://www.valley.ne.jp/~ariakehs/Wadokei/hours_system.html
=head1 SEE ALSO
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Julian.pm view on Meta::CPAN
my @start_of_month = (0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337);
# Julian dates are formatted in exactly the same way as Gregorian dates,
# so we use most of the DateTime methods.
# This is the difference between Julian and Gregorian calendar:
sub _is_leap_year {
    my (undef, $year) = @_;	# Invocant unused
    return ($year % 4 == 0);
}
lib/DateTime/Calendar/Julian.pm view on Meta::CPAN
	}
	return $y, $m, $d;
    }
}
sub calendar_name {
    return 'Julian';
}
sub epoch {
    my $self = shift;
lib/DateTime/Calendar/Julian.pm view on Meta::CPAN
__END__
=head1 NAME
DateTime::Calendar::Julian - Dates in the Julian calendar
=head1 SYNOPSIS
  use DateTime::Calendar::Julian;
lib/DateTime/Calendar/Julian.pm view on Meta::CPAN
This module implements one additional method besides the ones from
DateTime, and changes the output of one other method.
=over 4
=item * calendar_name
Returns C<'Julian'>.
=item * gregorian_deviation
Returns the difference in days between the Gregorian and the Julian
calendar.
=item * datetime
  print $dt->datetime( $sep ), "\n";
lib/DateTime/Calendar/Julian.pm view on Meta::CPAN
B<Note> that as of version C<0.106_01>, methods related to quarters
should work.
=head1 BACKGROUND
The Julian calendar was introduced by Julius Caesar in 46BC.  It
featured a twelve-month year of 365 days, with a leap year in February
every fourth year.  This calendar was adopted by the Christian church in
325AD.  Around 532AD, Dionysius Exiguus moved the starting point of the
Julian calendar to the calculated moment of birth of Jesus Christ. Apart
from differing opinions about the start of the year (often January 1st,
but also Christmas, Easter, March 25th and other dates), this calendar
remained unchanged until the calendar reform of pope Gregory XIII in
1582.  Some backward countries, however, used the Julian calendar until
the 18th century or later.
This module uses the proleptic Julian calendar for years before 532AD,
or even 46BC.  This means that dates are calculated as if this calendar
had existed unchanged from the beginning of time.  The assumption is
made that January 1st is the first day of the year.
Note that BC years are given as negative numbers, with 0 denoting the
year 1BC (there was no year 0AD!), -1 the year 2BC, etc.
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Liturgical/Christian.pm view on Meta::CPAN
  my $advent_sunday = advent_sunday($y);
  if ($easter_point>-47 && $easter_point<0) {
      $season = 'Lent';
      $weekno = ($easter_point+50)/7;
      # FIXME: The ECUSA calendar seems to indicate that Easter Eve ends
      # Lent *and* begins the Easter season. I'm not sure how. Maybe it's
      # in both? Maybe the daytime is in Lent and the night is in Easter?
  } elsif ($easter_point>=0 && $easter_point<=49) {
      # yes, this is correct: Pentecost itself is in Easter season;
      # Pentecost season actually begins on the day after Pentecost.
lib/DateTime/Calendar/Liturgical/Christian.pm view on Meta::CPAN
__END__
=head1 NAME
DateTime::Calendar::Liturgical::Christian - calendar of the church year
=head1 SYNOPSIS
 $dtclc = DateTime::Calendar::Liturgical::Christian->new(
    day=>4,
lib/DateTime/Calendar/Liturgical/Christian.pm view on Meta::CPAN
 print $dtclc->colour();  # 'red'
=head1 DESCRIPTION
This module will return the name, season, week number and liturgical colour
for any day in the Gregorian calendar. It will eventually support the
liturgical calendars of several churches (hopefully at least Anglican,
Lutheran, Orthodox and Roman Catholic). At present it only knows the calendar
for the Episcopal Church of the USA.
If you find bugs, or if you have information on the calendar of another
liturgical church, please do let me know (thomas at thurman dot org dot uk).
=head1 OVERVIEW
Some churches use a special church calendar. Days and seasons within the year
may be either "fasts" (solemn times) or "feasts" (joyful times). The year is
structured around the greatest feast in the calendar, the festival of the
Resurrection of Jesus, known as Easter, and the second greatest feast, the
festival of the Nativity of Jesus, known as Christmas. Before Christmas and
Easter there are solemn fast seasons known as Advent and Lent respectively.
After Christmas comes the feast of Epiphany, and after Easter comes the feast
of Pentecost. These days have the adjacent seasons named after them.
lib/DateTime/Calendar/Liturgical/Christian.pm view on Meta::CPAN
=item new ([ OPTIONS ])
This constructs a DateTime::Calendar::Liturgical::Christian object. It takes
a series of named options. Possible options are:
B<year> (required). The year AD in the Gregorian calendar.
B<month> (required). The month number in the Gregorian calendar. 1 is January.
B<day> (required). The day of the month.
B<tradition> (recommended). The tradition to use. Currently only C<ECUSA> is known.
view release on metacpan or search on metacpan
DateTime::Calendar::Mayan
========================
This is a companion module to DateTime.pm. It implements the Mayan Long Count
calendar.
INSTALLATION
To install this module type the following:
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
sub _rd2ymd {
    my ($class, $rd) = @_;
    # Algorithm similar to the one on
    # http://home.capecod.net/~pbaum/date/injdalg2.htm
    # for the gregorian calendar
    # Number of days since 1 Pedale 127 (day after first extra leap day) =
    # 24-02-2000
    $rd -= 730173;
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
DateTime::Calendar::Pataphysical - Dates in the Pataphysical calendar
=head1 VERSION
version 0.07
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
                                               day   => 4 );
=head1 DESCRIPTION
DateTime::Calendar::Pataphysical is the implementation of the
Pataphysical calendar. Each year in this calendar contains 13 months of
29 days. This regularity makes this a convenient alternative for the
irregular Gregorian calendar.
This module is designed to be easy to use in combination with
L<DateTime>. Most of its methods correspond to a L<DateTime> method of the
same name.
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
This class method accepts parameters for each date and time component:
C<year>, C<month>, C<day>.  Additionally, it accepts a C<locale>
parameter.
The C<rd_secs> parameter is also accepted. This parameter is only useful
in conversions to other calendars; this calendar does not use its value.
=head2 from_epoch
    my $dt = DateTime::Calendar::Pataphysical->from_epoch( epoch => $epoch, ... );
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
    my $dt = DateTime::Calendar::Pataphysical->from_object( object => $object, ... );
This class method can be used to construct a new object from
any object that implements the L<utc_rd_values> method.  All
L<DateTime::Calendar> modules must implement this method in order to
provide cross-calendar compatibility.  This method accepts a
C<locale> parameter.
The time part of C<$object> is stored, and will only be used if the created
object is converted to another calendar. Only the date part of C<$object>
is used to calculate the pataphysical date. This calculation is based on
the local time and date of C<$object>.
=head2 last_day_of_month
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
=head2 week
    my ( $week_year, $week_number ) = $dt->week;
Returns information about the calendar week which contains this
L<DateTime> object. The values returned by this method are also available
separately through the L<week_year> and L<week_number> methods.
=head2 week_year
Returns the year of the week. In the Pataphysical calendar, this is
equal to the year of the date, as all weeks fall in one year only.
=head2 week_number
Returns the week of the year, from C<1 .. 53>.
lib/DateTime/Calendar/Pataphysical.pm view on Meta::CPAN
C<undef> for these dates.
=head2 utc_rd_values
Returns the current UTC Rata Die days and seconds as a two element
list.  This exists primarily to allow other calendar modules to create
objects based on the values provided by this object.
=head2 utc_rd_as_seconds
Returns the current UTC Rata Die days and seconds purely as seconds.
view release on metacpan or search on metacpan
lib/DateTime/Calendar/WarwickUniversity.pm view on Meta::CPAN
package DateTime::Calendar::WarwickUniversity;
=head1 NAME
DateTime::Calendar::WarwickUniversity - Warwick University academic calendar
=head1 SYNOPSIS
  use DateTime::Calendar::WarwickUniversity;
lib/DateTime/Calendar/WarwickUniversity.pm view on Meta::CPAN
  print join(', ', $dt->term_and_week);
=head1 DESCRIPTION
DateTime::Calendar::WarwickUniversity is used for working with the
academic calendar in use at the University of Warwick.
=cut
use 5.008004;
use strict;
view release on metacpan or search on metacpan
lib/DateTime/Duration/Lite.pm view on Meta::CPAN
sub is_limit_mode    { $_[0]->end_of_month eq 'l' ? 1 : 0 }
sub is_preserve_mode { $_[0]->end_of_month eq 'p' ? 1 : 0 }
sub end_of_month_mode { $_[0]->end_of_month }
sub calendar_duration {
    my $self = shift;
    return ( ref $self )
        ->new( map { $_ => $self->$_ } qw( _months _days _end_of_month ) );
}
view release on metacpan or search on metacpan
lib/DateTime/Event/Cron/Quartz.pm view on Meta::CPAN
    # move ahead one second, since we're computing the time *after* the
    # given time
    $after_time->add( seconds => 1 );
    # operable calendar
    my $cl = $after_time->clone;
    my $got_one = 0;
    # loop until we've computed the next time, or we've past the endTime
lib/DateTime/Event/Cron/Quartz.pm view on Meta::CPAN
                $hr++;
            }
            if ( $min != $t ) {
                $cl->set( second => 0, minute => $min );
                $this->set_calendar_hour( $cl, $hr );
                next ITER;
            }
            $cl->set( minute => $min );
        }
lib/DateTime/Event/Cron/Quartz.pm view on Meta::CPAN
            if ( $hr != $t ) {
                $cl->add( days => $day - $cl->day );
                $cl->set( second => 0, minute => 0 );
    
                $this->set_calendar_hour( $cl, $hr );
                next ITER;
            }
    
            $cl->set( hour => $hr );
        }
lib/DateTime/Event/Cron/Quartz.pm view on Meta::CPAN
    }    # while( !done )
    return $cl;
}
#* Advance the calendar to the particular hour paying particular attention
#* to daylight saving problems.
#*
#* @param cal
#* @param hour
sub set_calendar_hour {
    my $this = shift;
    my ( $cal, $hour ) = @_;
    my $delta = 0;
view release on metacpan or search on metacpan
lib/DateTime/Event/Easter.pm view on Meta::CPAN
March 21st. Easter Sunday is never on the full moon. Thus the earliest
Easter can be is March 22nd.
In the orthodox world, although they now use the Gregorian Calendar
rather than the Julian, they still take the first full moon on or after the
Julian March 21st. As the Julian calendar is slowly getting further and
further out of sync with the Gregorian, the first full moon after this
date can be a completely different one than for the western Easter. This
is why the Orthodox churches celebrate Easter later than western
churches.
lib/DateTime/Event/Easter.pm view on Meta::CPAN
=item * western_epact($year)
In the  Gregorian comput, the epact  is the age of  the ecclesiastical
Moon on the 1st January of the  given year. The C<western> part of the
subroutine  name  accounts for  the  fact  that Gregorian  and  Julian
calendars do not use the same formula.
The epact  is a 0..29 number.  The "0" value  is shown as "*"  in some
sources. This  subroutine does not convert  "0" to "*", the  result is
always a pure number.
lib/DateTime/Event/Easter.pm view on Meta::CPAN
=item * eastern_epact($year)
In the Julian comput, the epact  is the age of the ecclesiastical Moon
on 22nd March. The C<eastern> part of the subroutine name accounts for
the  fact that  Gregorian and  Julian calendars  do not  use the  same
formula.
The epact  is a 0..29 number.  The "0" value  is shown as "*"  in some
sources. This  subroutine does not convert  "0" to "*", the  result is
always a pure  number. There is no  other special case, for  25 as for
lib/DateTime/Event/Easter.pm view on Meta::CPAN
=over 4
=item * L<https://github.com/houseabsolute/DateTime.pm/wiki> - The official wiki
of the DateTime project
=item * L<https://www.tondering.dk/claus/calendar.html> - Claus Tøndering's
calendar FAQ, especially the page L<https://www.tondering.dk/claus/cal/easter.php>.
=item * I<Calendrical Calculations> (Third or Fourth Edition) by Nachum Dershowitz and
Edward M. Reingold, Cambridge University Press, see
L<http://www.calendarists.com>
or L<https://www.cambridge.org/us/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition?format=PB&isbn=9781107683167>,
ISBN 978-0-521-70238-6 for the third edition.
=item * I<La saga des calendriers>, by Jean Lefort, published by I<Belin> (I<Pour la Science>), ISBN 2-90929-003-5
See L<https://www.belin-editeur.com/la-saga-des-calendriers>
lib/DateTime/Event/Easter.pm view on Meta::CPAN
Much help from the DateTime mailing list, especially from:
B<Eugene van der Pijll> - who pointed out flaws causing errors on
gregorian years with no eastern easter (like 35000) and who came up with
a patch to make the module accept any calendar's DateTime object
B<Dave Rolsky> - who picked nits, designed DateTime itself and leads the project
B<Martin Hasch> - who pointed out the posibility of memory leak with an early beta
view release on metacpan or search on metacpan
TODO list for Perl module DateTime-Event-ICal
* high frequency FREQ can be optimized by precomputing larger steps of INTERVAL
* include this in docs:
  http://www.w3.org/2001/sw/Europe/200210/calendar/vocab_usecases.html
  http://www.imc.org/ietf-calendar/mail-archive/msg00623.html
* optimize yealy/monthly + interval + byday
  - uses intersection with "all days"
* "byday -2 friday"
view release on metacpan or search on metacpan
The Functions (code, comments, and definitions) contained on this compact disk (the "Program") were written by Edward M. Reingold and Nachum Dershowitz (the "Authors"), who retain all rights to them except as granted in the License and subject to the...
The Authors' public service intent is more liberal than suggested by the License below, as are their licensing policies for otherwise nonallowed uses such as--without limitation--those in commercial, web-site, and large-scale academic contexts. Pleas...
http://www.calendarists.com
for all uses not authorized below; in case there is cause for doubt about whether a use you contemplate is authorized, please contact the Authors (email: reingold@iit.edu) . For commercial licensing information, contact the first author at the Depart...
1. LICENSE. The Authors grant you a license for personal use only. This means that for strictly personal use you may copy and use the code, and keep a backup or archival copy also. Any other uses, including without limitation, allowing the code or it...
view release on metacpan or search on metacpan
lib/DateTime/Event/NameDay.pm view on Meta::CPAN
    # - Find our section
    my $nameday_info = 
	$self->_init_nameday_country(namedays => \%namedays,
				     country  => $country);
    # - Convert to the Julian calendar
    my $adj_dt = DateTime::Calendar::Christian->from_object
	(object      => $p{date},
	 reform_date => $nameday_info->{reform_date},
	 %{ $self->date_args() },
	 );
lib/DateTime/Event/NameDay.pm view on Meta::CPAN
C<DateTime::Set> object that can be used to work out what dates are
for the given name.
Please note that the calculations are done using the
C<DateTime::Calendar::Christian> module to deal with dates that fall
before the calendar reforms.
=head1 USAGE
TODO
view release on metacpan or search on metacpan
lib/DateTime/Event/WarwickUniversity.pm view on Meta::CPAN
package DateTime::Event::WarwickUniversity;
=head1 NAME
DateTime::Event::WarwickUniversity - Warwick University academic calendar events
=head1 SYNOPSIS
  use DateTime::Event::WarwickUniversity;
lib/DateTime/Event/WarwickUniversity.pm view on Meta::CPAN
  # 2004-09-28
  my $dt_ac = DateTime::Event::Warwick->new_year_for_academic_year($dt);
=head1 DESCRIPTION
DateTime::Event::WarwickUniversity is used to work with the academic calendar
of the University of Warwick.
=cut
use 5.008004;
lib/DateTime/Event/WarwickUniversity.pm view on Meta::CPAN
use Scalar::Util qw/blessed/;
our $VERSION = '0.05';
# http://web.archive.org/web/19980114233111/warwick.ac.uk/info/dates.html
# http://web.archive.org/web/20001101110549/www.warwick.ac.uk/info/calendar/section1/1.01.html
# http://www2.warwick.ac.uk/insite/info/gov/calendar/section1/termdates/
# http://www2.warwick.ac.uk/services/gov/calendar/section1/termdates
my %new_year = (
	1996 => ['09', '30'],
	1997 => ['09', '29'],
	1998 => ['10', '05'],
lib/DateTime/Event/WarwickUniversity.pm view on Meta::CPAN
=head2 new_year_for_gregorian_year
Takes as argument a single L<DateTime> object.
Returns a L<DateTime> object representing the first day of the academic
calendar that begins in the same Gregorian year as the input.
=cut
sub new_year_for_gregorian_year {
	my ($class, $dt) = @_;
lib/DateTime/Event/WarwickUniversity.pm view on Meta::CPAN
}
# _new_year_dt_from_gregorian_year
#
# Not part of public API. Takes a string containing a year, and returns a
# DateTime object representing the first day of the academic calendar that
# began in that Gregorian year.
sub _new_year_dt_from_gregorian_year {
	my $year = shift;
view release on metacpan or search on metacpan
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
	    $self->{month},
	    $self->{day} || $self->{holiday},
	),
    );
    # Because the leap year algorithm is the same in both calendars, I
    # can use __rata_die_to_year_day() on the Gregorian Rata Die day.
    ( $dt_args{year}, $dt_args{day_of_year} ) = __rata_die_to_year_day(
	$shire_rd - GREGORIAN_RATA_DIE_TO_SHIRE );
    # We may be calling this because we have fiddled with the Shire date
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
    }
}
sub last_day_of_month {
    my ( $class, %arg ) = @_;
    $arg{day} = 30; # The shire calendar is nice this way
    return $class->new( %arg );
}
{
    my $validator = Params::ValidationCompiler::validation_for(
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
    $dt_arg{month} += 1;
    $dt_arg{year}  += 1900;
    return $class->from_object( %arg, object => DateTime->new( %dt_arg ) );
}
sub calendar_name {
    return 'Shire';
}
sub clone {
    my ( $self ) = @_;
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
*doy  = \&day_of_year;	# sub doy
sub week { return ($_[0]->week_year, $_[0]->week_number); }
*week_year  = \&year;	# sub week_year; the shire calendar is nice this way
sub week_number {
    my $self = shift;
    # TODO re-implement in terms of __week_of_year
    my $yday = $self->day_of_year;
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
		@midnight,
	    );
	},
	quarter	=> sub {
	    my ( $self ) = @_;
	    # This is an extension to the Shire calendar by Tom Wyant.
	    # It has no textual justification whatsoever. Feel free to
	    # pretend it does not exist.
	    if ( my $quarter = $self->quarter() ) {
		# The start of a quarter is tricky since quarters 1 and
		# 3 start on holidays, so we just do a table lookup.
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
    return POSIX::floor( ( ( $_[0]->day - 1 ) / 7 ) + 1 );
}
# ISO says that the first week of a year is the first week containing
# a Thursday. Extending that says that the first week of the month is
# the first week containing a Thursday. ICU agrees.
# ISO does not really apply to the Shire calendar. This method is
# algorithmically the same as the DateTime method, which amounts to
# taking the first week of the year to be the first week containing a
# Hevensday. We return nothing (undef in scalar context) on a holiday
# because zero is a valid return (e.g. for 1 Rethe). -- TRW
sub week_of_month {
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
__END__
=head1 NAME
DateTime::Fiction::JRRTolkien::Shire - DateTime implementation of the Shire calendar.
=head1 SYNOPSIS
    use DateTime::Fiction::JRRTolkien::Shire;
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
    # On this date in history
    print $shire->on_date;
=head1 DESCRIPTION
Implementation of the calendar used by the hobbits in J.R.R. Tolkien's
exceptional novel The Lord of The Rings, as described in Appendix D of
that book (except where noted).  The calendar has 12 months, each with
30 days, and 5 holidays that are not part of any month.  A sixth
holiday, Overlithe, is added on leap years.  The holiday Midyear's Day
(and the Overlithe on a leap year) is not part of any week, which means
that the year always starts on Sterday.
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
        object  => $object,
        ...
    );
Same as in DateTime, but you can also specify parameters C<accented> and
C<traditional> (see L<new()|/new>). Takes any other DateTime calendar
object and converts it to a DateTime::Fiction::JRRTolkien::Shire object.
=head3 last_day_of_month
    $dts = DateTime::Fiction::JRRTolkien::Shire->last_day_of_month(
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
        ...
    );
Same as in DateTime.  Like the C<new()> constructor, but it does not
take a day parameter.  Instead, the day is set to 30, which is the last
day of any month in the shire calendar. A holiday parameter should not
be used with this method.  Use L<new()|/new> instead.
=head3 from_day_of_year
    $dts = DateTime::Fiction::JRRTolkien::Shire->from_day_of_year(
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
Creates a new Shire object that is the same date (and underlying time)
as the calling object.
=head2 "Get" Methods
=head3 calendar_name
    print $dts->calendar_name(), "\n";
Returns C<'Shire'>.
=head3 year
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
    printf "%d %s a leap year\n", $dts->year(),
        $ly[ $dts->is_leap_year() ];
Returns 1 if the year is a leap year, and 0 otherwise.
Leap years are given the same rule as the Gregorian calendar.  Every
four years is a leap year, except the first year of the century, which
is not a leap year.  However, every fourth century (400 years), the
first year of the century is a leap year (every 4, except every 100,
except every 400).  This is a slight change from the calendar described
in Appendix D, which uses the rule of once every 4 years, except every
100 years (the same as in the Julian calendar).  Given some uncertainty
about how many years have passed since the time in Lord of the Rings
(see note below), and the expectations of most people that the years
match up with what they're used to, I have changed this rule for this
implementation.  However, this does mean that this calendar
implementation is not strictly that described in Appendix D.
=head3 week_year
    print 'The week year is ', $dts->week_year(), "\n";
This is always the same as the year in the shire calendar, but is
present for compatibility with other DateTime objects.
=head3 week_number
    print 'The week number is ', $dts->week_number(), "\n";
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
the day is part of no quarter (Midyear's day and the Overlithe), returns
0.
There is no textual justification for quarters, but they are in the
L<DateTime|DateTime> interface, so I rationalized the concept the same
way the Shire calendar rationalizes weeks. If you are not interested in
non-canonical functionality, please ignore anything involving quarters.
=head3 quarter_0
Returns the number of the quarter the day is in, in the range 0 to 3. If
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
Returns either C<'SR'> if the year is positive, or C<'BSR'> otherwise.
=head3 christian_era
This really does not apply to the Shire calendar, but it is part of the
L<DateTime|DateTime> interface. Despite its name, it returns the same
thing that L<era_abbr()|/era_abbr> does.
=head3 secular_era
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
=head3 utc_rd_values
Returns the UTC rata die days, seconds, and nanoseconds. Ignores
fractional seconds.  This is the standard method used by other methods
to convert the shire calendar to other calendars.  See the DateTime
documentation for more information.
=head3 utc_rd_as_seconds
Returns the UTC rata die days entirely as seconds.
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
This is a re-implementation imported from
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data>. It is intended
to be reasonably compatible with the same-named L<DateTime|DateTime>
method, but has some additions to deal with the peculiarities of the
Shire calendar.
See L<__format()|Date::Tolkien::Shire::Data/__format> in
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data> for the
documentation, since that is the code that does the heavy lifting for
us.
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
falling in any month, it is recommended that a day and month always be
given together.  Otherwise, unanticipated results may occur.
As in the L<new()|/new> constructor, time parameters have no effect on
the Shire dates returned.  However, they are maintained in case the
object is converted to another calendar which supports time.
All C<set_*()> methods from L<DateTime|DateTime> are provided. In
addition, you get the following:
=head3 set_holiday
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
Similarly, if the date is Midyear's day or the Overlithe, truncation to
C<'week'>, C<'local_week'>, or C<'quarter'> is equivalent to truncation
to C<'day'>, since these holidays are not part of any week (or, by
extension, quarter).
The week in the Shire calendar begins on Sterday, so both C<'week'> and
C<'local_week'> truncate to that day.
There is no textual justification for quarters, but they are in the
L<DateTime|DateTime> interface, so I rationalized the concept the same
way the Shire calendar rationalizes weeks. If you are not interested in
non-canonical functionality, please ignore anything involving quarters.
=head3 set_time_zone
    $dts->set_time_zone( 'UTC' );
Just like in DateTime. This method has no effect on the shire calendar,
but be stored with the date if it is ever converted to another calendar
with time support.
=head2 Comparisons and Stringification
All comparison operators should work, just as in DateTime.  In addition,
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
into a string representing the date when used in a double-quoted string.
=head2 Durations and Date Math
Durations and date math are supported as of 0.900_01.
Because of the peculiarities of the Shire calendar, the relevant
duration object is
L<DateTime::Fiction::JRRTolkien::Shire::Duration|DateTime::Fiction::JRRTolkien::Shire::Duration>,
which is B<not> a subclass of L<DateTime::Duration|DateTime::Duration>.
The date portion of the math is done in the order L<month|/month>,
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
the start of the 4th age (1422 S.R.).  Thus the fourth age begins in our
B.C 4042.
According to Appendix D of the Lord of the Rings, leap years in the
hobbits'
calendar are every 4 years unless it is the turn of the century, in which
case it is not a leap year. Our calendar (Gregorian) uses every 4 years
unless it's 100 years unless its 400 years.  So, if no changes have been
made to the hobbits' calendar since the end of the third age, their
calendar would be about 15 days further behind ours now than when the
War of the Ring took place.  Implementing this seemed to me to go
against Tolkien's general habit of converting dates in the novel to our
equivalents to give us a better sense of time.  My thought, at least
right now, is that it is truer to the spirit of things for years to line
up, and for Midyear's day to still be approximately on the summer
solstice.  So instead, I have modified Tolkien's description of the
hobbit calendar so that leap years occur once every 4 years unless it's
100 years unless it's 400 years, so as it matches the Gregorian calendar
in that regard.  These 100 and 400 year intervals occur at different
times in the two calendars, so there is not a one to one correspondence
of days regardless of years.  However, the variations follow a 400 year
cycle.
I<The "I" in the above is Tom Braun -- TRW>
lib/DateTime/Fiction/JRRTolkien/Shire.pm view on Meta::CPAN
Copyright (c) 2003 Tom Braun. All rights reserved.
Copyright (C) 2017-2022, 2025 Thomas R. Wyant, III
The calendar implemented on this module was created by J.R.R. Tolkien,
and the copyright is still held by his estate.  The license and
copyright given herein applies only to this code and not to the
calendar itself.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. For more details, see the full text
of the licenses in the LICENSES directory included with this module.
view release on metacpan or search on metacpan
lib/DateTime/Fiscal/Retail454.pm view on Meta::CPAN
This module is a sub-class of C<DateTime> and inherits all methods and
capabilities, including constructors, of that module.
The purpose of this module is to make it easy to work with the 4-5-4
calendar that is common among merchandisers.  Details of the calendar itself
can be found at the National Retail Federation (NRF) website.
L<http://www.nrf.com/modules.php?name=Pages&sp_id=391>
All objects returned by any of the methods in this module or of the class
C<DateTime::Fiscal::Retail454> unless otherwise specified.
lib/DateTime/Fiscal/Retail454.pm view on Meta::CPAN
 
 my $r454_2 = DateTime::Fiscal::Retail454->new( year => 2006, month = 1 );
 print $r454->r454_year;	# print "2005"
Returns a scalar containing the Fiscal Year that the object is in.  This is
not always the same as the calendar year, especially for dates in January and
occasionally in February.  This is because the start of the Fiscal Year is
tied to what day of the week Jan 31 of any given year falls on.
=head2 is_r454_leap_year
view release on metacpan or search on metacpan
lib/DateTime/Fiscal/Year.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows you to calulate the day, week, period or quarter of a date in a fiscal year, given a
start date and either a target date or number of periods and target date. This is often needed in business, 
where the fiscal year begins and ends on different days than the calendar year. This module is based on the
Gregorian calendar. Using other DT calendar objects will return results, but the behavior
is unpredicatable for calendars that have more than 365 or 366 days.
=head1 USAGE
This module implements the following methods:
view release on metacpan or search on metacpan
lib/DateTime/Format/Epoch/JD.pm view on Meta::CPAN
=head1 DESCRIPTION
This module can convert a DateTime object (or any object that can be
converted to a DateTime object) to the Julian Day number. This is the
number of days since noon U.T.C. on January 1, 4713 B.C. (Julian
calendar).
This time scale was originally proposed by John Herschel, and is
often used in astronomical calculations.
Similar modules are:
lib/DateTime/Format/Epoch/JD.pm view on Meta::CPAN
=item * DateTime::Format::Epoch::Lilian
Implements the Lilian count, named after Aloysius Lilian (a 16th century
physician) and first used by IBM (a 19th century punched card machine
manufacturer).  This counts the number of days since the adoption of the
Gregorian calendar.  Only days are counted, and October 15, 1584 is day
1.
=back
=head1 METHODS
view release on metacpan or search on metacpan
lib/DateTime/Format/EraLegis.pm view on Meta::CPAN
 my $dt->set_formatter($dtf);
=head1 DESCRIPTION
These three modules combined enable DateTime objects to emit date strings
formatted according to the Thelemic calendar. The ephemeris provides access
to the planetary location of the Sun and Moon keyed by UTC timestamp. The
style dictates the specific expression of the of datetime value using a
template into which one can place tokens which can be converted into the
sign/degree coordinates for the given date. A default style exists and is
permutable by boolean attributes.
view release on metacpan or search on metacpan
t/lang-de.t view on Meta::CPAN
use DateTime::Format::Flexible;
my $curr_year = DateTime->now->year;
# http://www.dummies.com/how-to/content/mastering-the-calendar-and-dates-in-german.html
# http://german.about.com/library/anfang/blanfang12b.htm
t::lib::helper::run_tests(
    [ european => 1 ],
    "20. Feb am Mittag => $curr_year-02-20T12:00:00",
    "20. Feb um Mitternacht => $curr_year-02-20T00:00:00",
view release on metacpan or search on metacpan
lib/DateTime/Format/Genealogy.pm view on Meta::CPAN
if it is an approximate date starting with "c", "ca" or "abt".
Can be called as a class or object method.
    my $dt = DateTime::Format::Genealogy->new()->parse_datetime('25 Dec 2022');
Recognizes GEDCOM calendar escapes such as @#DJULIAN@, @#DHEBREW@, and @#DFRENCH R@,
converting them to DateTime objects when the appropriate calendar modules are installed.
Mandatory arguments:
=over 4
lib/DateTime/Format/Genealogy.pm view on Meta::CPAN
	my $params = Params::Get::get_params('date', @_);
	if((!ref($params->{'date'})) && (my $date = $params->{'date'})) {
		my $quiet = $params->{'quiet'};
		# Detect GEDCOM calendar escape
		my $calendar_type = 'DGREGORIAN';
		if ($date =~ s/^@#D([A-Z ]+?)@\s*//) {
			$calendar_type = 'D' . uc($1);  # normalise
		}
		# TODO: Needs much more sanity checking
		if(($date =~ /^bef\s/i) || ($date =~ /^aft\s/i) || ($date =~ /^abt\s/i)) {
			Carp::carp("$date is invalid, need an exact date to create a DateTime")
lib/DateTime/Format/Genealogy.pm view on Meta::CPAN
			if(($date =~ /^\d/) && (my $d = $self->_date_parser_cached($date))) {
				# D:T:Natural doesn't seem to work before AD100
				return if($date =~ /\s\d{1,2}$/);
				my $rc = $dfn->parse_datetime($d->{'canonical'});
				if($rc && $calendar_type ne 'DGREGORIAN') {
					return _convert_calendar($rc, $calendar_type, $quiet);
				}
				return $rc;
			}
			if(($date !~ /^(Abt|ca?)/i) && ($date =~ /^[\w\s,]+$/)) {
lib/DateTime/Format/Genealogy.pm view on Meta::CPAN
	}
	return;
}
sub _convert_calendar {
	my ($dt, $calendar_type, $quiet) = @_;
	if($calendar_type eq 'DJULIAN') {
		# In a Gedcom, DJULIAN refers to a date in the Julian calendar format, using the @#DJULIAN@ escape to indicate it
		# Approximate historical offset
		my $offset_days = _julian_to_gregorian_offset($dt->year);
		return $dt->clone->add(days => $offset_days);
	} elsif ($calendar_type eq 'DHEBREW') {
		eval {
			require DateTime::Calendar::Hebrew;
			my $h = DateTime::Calendar::Hebrew->new(
				year  => $dt->year,
				month => $dt->month,
				day   => $dt->day
			);
			return DateTime->from_object(object => $h);
		};
		Carp::carp("Hebrew calendar conversion failed: $@") if $@ && !$quiet;
	} elsif ($calendar_type =~ /FRENCH R/) {
		eval {
			require DateTime::Calendar::FrenchRevolutionary;
			my $f = DateTime::Calendar::FrenchRevolutionary->new(
				year  => $dt->year,
				month => $dt->month,
				day   => $dt->day
			);
			return DateTime->from_object(object => $f);
		};
		Carp::carp("French Republican calendar conversion failed: $@") if $@ && !$quiet;
	} else {	# e.g DROMAN
		Carp::carp("Calendar type $calendar_type not supported") unless $quiet;
	}
	return $dt;
}
sub _julian_to_gregorian_offset {
view release on metacpan or search on metacpan
lib/DateTime/Format/Intl.pm view on Meta::CPAN
            return( $self->pass_error( $cldr->error ) );
        # We remove the last 'und' special fallback locale
        pop( @$tree );
        foreach my $l ( @$tree )
        {
            my $ref = $cldr->calendar_formats_l10n(
                locale => $l,
                calendar => 'gregorian',
            );
            return( $self->pass_error( $cldr->error ) ) if( !defined( $ref ) && $cldr->error );
            if( $ref )
            {
                if( Scalar::Util::blessed( $loc ) && ref( $loc ) eq 'Locale::Intl' )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    {
        # RangeError: invalid value "plop" for option month
        my %valid_options = 
        (
            localeMatcher           => ['lookup', 'best fit'],
            # calendar is processed separately
            # numberingSystem is processed separately
            calendar                => qr/[a-zA-Z][a-zA-Z0-9]+(?:\-[a-zA-Z][a-zA-Z0-9]+)*/,
            numberingSystem         => qr/[a-zA-Z][a-zA-Z0-9]+/,
            timeZone                => qr/[a-zA-Z0-9\/\_\-\+]+/,
            year                    => [qw( numeric 2-digit )],
            month                   => [qw( numeric 2-digit long short narrow )],
            day                     => [qw( numeric 2-digit )],
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    my $resolved = 
    {
        locale => $locale,
    };
    @$resolved{ @core_options } = @$opts{ @core_options };
    my $calendar = $opts->{calendar};
    my $tz = $opts->{timeZone};
    my $tzNameOpt = $opts->{timeZoneName};
    my $date_style = $opts->{dateStyle};
    my $time_style = $opts->{timeStyle};
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    my $h12 = $opts->{hour12};
    my $pattern;
    my $num_sys = $opts->{numberingSystem};
    if( !$calendar )
    {
        if( $calendar = $locale->calendar )
        {
            $opts->{calendar} = $calendar;
        }
        else
        {
            $opts->{calendar} = $calendar = 'gregorian';
        }
    }
    $calendar = 'gregorian' if( $calendar eq 'gregory' );
    if( lc( $calendar ) ne 'gregory' &&
        lc( $calendar ) ne 'gregorian' )
    {
        warn( "The local provided has the calendar attribute set to \"${calendar}\", but this API only supports \"gregory\" or \"gregorian\"." ) if( warnings::enabled() );
        $calendar = 'gregorian';
    }
    $resolved->{calendar} = $calendar;
    # NOTE: timeStyle or hour is define, we do some check and processing for interdependency
    if( length( $time_style // '' ) || $opts->{hour} )
    {
        # Surprisingly, the 'hour12' option takes precedence over the 'hourCycle' even though the latter is more specific.
lib/DateTime/Format/Intl.pm view on Meta::CPAN
        # const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
        # hour12: true, hour: "numeric", hourCycle: "h24"
        # console.log( new Intl.DateTimeFormat('en-US', { hour12: true, hour: "numeric", hourCycle: "h24" }).resolvedOptions() );
        # results in the following resolvedOptions:
        # {
        #     calendar: "gregory",
        #     hour: "2-digit",
        #     hour12: false,
        #     hourCycle: "h23",
        #     locale: "en-US",
        #     numberingSystem: "latn",
lib/DateTime/Format/Intl.pm view on Meta::CPAN
            return( $self->pass_error( $cldr->error ) );
        my $width;
        my $supported = {};
        LOCALE: foreach my $loc ( @$tree )
        {
            my $all = $cldr->calendar_eras_l10n(
                locale => $loc,
                calendar => $calendar,
            );
            return( $self->pass_error( $cldr->error ) ) if( !defined( $all ) && $cldr->error );
            if( $all )
            {
                foreach my $this ( @$all )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
            return( $self->pass_error( $cldr->error ) );
        my $width;
        my $supported = {};
        LOCALE: foreach my $loc ( @$tree )
        {
            my $all = $cldr->calendar_terms(
                locale => $loc,
                calendar => $calendar,
                term_type => $prop,
                term_context => 'format',
            );
            return( $self->pass_error( $cldr->error ) ) if( !defined( $all ) && $cldr->error );
            if( $all && scalar( @$all ) )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    my $options_map = $self->_get_options_map;
    my $component_to_match =
    {
        # Those are not related to pattern, but because they are in our options we add them here to avoid an error, but discard them later
        calendar => undef,
        numberingSystem => undef,
        # This option is used as an ancillary value to hourCycle option
        hour12 => undef,
        # hourCycle itself is only present if the option 'hour' is set
        hourCycle => undef,
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    {
        die( "The value provided for missing components (", overload::StrVal( $missing ), ") is not an array reference." );
    }
    my $cldr = $self->{_cldr} || die( "The Locale::Unicode::Data object is gone." );
    my $locale = $self->{locale} || die( "The locale value is gone!" );
    my $calendar = $self->{calendar} || 'gregorian';
    my $alias =
    {
        'c' => 'E',
        'e' => 'E',
        'H' => 'h',
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    # my @ordered_options = qw( era year month weekday day dayPeriod hour minute second timeZoneName );
    # becomes:
    my @ordered_options = qw( G y M E d B h m s Z );
    # Possible components found in skeleton in CLDR data: [qw( B E G H M Q W Z c d h m s v w y )]
    # All possible format ID known in the CLDR calendar_append_formats table
    my $map =
    {
        # 'B' has no correspondence in table calendar_append_formats, but has in table date_terms
        'c' => ['Day-Of-Week' => 'weekday'],
        'd' => ['Day' => 'day'],
        'e' => ['Day-Of-Week' => 'weekday'],
        'E' => ['Day-Of-Week' => 'weekday'],
        'G' => ['Era' => 'era'],
lib/DateTime/Format/Intl.pm view on Meta::CPAN
        # e.g.: {0} {1}
        # or: {0} ({2}: {1})
        my $pat;
        foreach my $loc ( @$tree )
        {
            my $ref = $cldr->calendar_append_format(
                format_id => $elem,
                locale => $loc,
                calendar => $calendar,
            );
            return( $self->pass_error( $cldr->error ) ) if( !defined( $ref ) && $cldr->error );
            if( $ref )
            {
                $pat = $ref->{format_pattern};
lib/DateTime/Format/Intl.pm view on Meta::CPAN
sub _get_available_format_patterns
{
    my $self = shift( @_ );
    my $cldr = $self->{_cldr} || die( "The Locale::Unicode::Data object is gone." );
    my $locale = $self->{locale} || die( "The locale value is gone!" );
    my $calendar = $self->{calendar} || 'gregorian';
    # "The dateFormatItems inherit from their parent locale, so the inherited items need to be considered when processing."
    # <https://www.unicode.org/reports/tr35/tr35-dates.html#Mapping_Requested_Time_Skeletons_To_Patterns>
    my $tree = $cldr->make_inheritance_tree( $locale ) ||
        return( $self->pass_error( $cldr->error ) );
    # Keep track of the format skeleton already found, so we do not replace them while going up the tree
    my $patterns = {};
    local $" = ', ';
    foreach my $loc ( @$tree )
    {
        my $all = $cldr->calendar_available_formats(
            locale      => $loc,
            calendar    => $calendar,
            alt         => undef,
            # count might contain some value
        );
        return( $self->pass_error ) if( !defined( $all ) && $cldr->error );
        if( $all && scalar( @$all ) )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
{
    my $self = shift( @_ );
    my $diff = shift( @_ ) || die( "No greatest difference component was provided." );
    my $cldr = $self->{_cldr} || die( "The Locale::Unicode::Data object is gone." );
    my $locale = $self->{locale} || die( "The locale value is gone!" );
    my $calendar = $self->{calendar} || 'gregorian';
    # Get all the interval patterns for the given greatest difference
    # "The dateFormatItems inherit from their parent locale, so the inherited items need to be considered when processing."
    # <https://www.unicode.org/reports/tr35/tr35-dates.html#Mapping_Requested_Time_Skeletons_To_Patterns>
    my $tree = $cldr->make_inheritance_tree( $locale ) ||
        return( $self->pass_error( $cldr->error ) );
    my $patterns = {};
    local $" = ', ';
    foreach my $loc ( @$tree )
    {
        my $all = $cldr->calendar_interval_formats(
            locale => $loc,
            calendar => $calendar,
            greatest_diff_id => $diff,
        );
        if( $all && scalar( @$all ) )
        {
            for( @$all )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    die( "Bad datetime format '${type}'" ) if( $type ne 'atTime' && $type ne 'standard' );
    my $cldr = $self->{_cldr} || die( "The Locale::Unicode::Data object is gone." );
    my $locale = $self->{locale} || die( "Our Locale::Unicode object is gone!" );
    my $locales = $cldr->make_inheritance_tree( $locale ) ||
        return( $self->pass_error( $cldr->error ) );
    my $calendar = $self->{calendar} || 'gregorian';
    my $pattern;
    foreach my $loc ( @$locales )
    {
        my $ref = $cldr->calendar_datetime_format(
            locale          => $loc,
            calendar        => $calendar,
            format_type     => $type,
            format_length   => $width,
        );
        return( $self->pass_error ) if( !defined( $ref ) && $cldr->error );
        if( $ref && $ref->{format_pattern} )
lib/DateTime/Format/Intl.pm view on Meta::CPAN
            return( exists( $opts->{timeZoneName} ) ? $options_map->{timezone}->{ $opts->{timeZoneName} } : 'v' );
        },
        # 'w' (week of year) and 'W' (week of month) are also found in the skeletons. 309 and 322 times respectively.
        # 'Q' (quarter) is also found 419 times in the skeletons, amazingly enough.
    };
    # SELECT DISTINCT(format_id) FROM calendar_available_formats WHERE format_id regexp('G') ORDER BY LENGTH(format_id), format_id;
#     my $singletons =
#     {
#         # Bh, Bhm, Bhms, EBhm, EBhms
#         'B' => 1,
#         # 'c' can have multiple occurrence
lib/DateTime/Format/Intl.pm view on Meta::CPAN
           scalar( @{$request_object->date_components // []} ) &&
           scalar( @{$request_object->time_components // []} ) &&
           !$diff &&
           !$args->{subprocess} )
    {
        my @core_options = qw( calendar hour12 hourCycle locale numberingSystem timeZone );
        my @date_options = ( qw( era year month weekday day ), @core_options );
        my @time_options = ( qw( hour minute second timeZoneName  ), @core_options );
        # "1. Divide the request into a date fields part and a time fields part."
        my $date_opts = +{ map{ $_ => $opts->{ $_ } } grep( exists( $opts->{ $_ } ), @date_options ) };
        my $time_opts = +{ map{ $_ => $opts->{ $_ } } grep( exists( $opts->{ $_ } ), @time_options ) };
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    my $fmt = DateTime::Format::Intl->new(
        # You can use ja-JP (Unicode / web-style) or ja_JP (system-style), it does not matter.
        'ja_JP', {
            localeMatcher => 'best fit',
            # The only one supported. You can use 'gregory' or 'gregorian' indifferently
            calendar => 'gregorian',
            # see getNumberingSystems() in Locale::Intl for the supported number systems
            numberingSystem => 'latn',
            formatMatcher => 'best fit',
            dateStyle => 'long',
            timeStyle => 'long',
lib/DateTime/Format/Intl.pm view on Meta::CPAN
    my $fmt = DateTime::Format::Intl->new(
        # You can also use ja-JP (Unicode / web-style) or ja_JP (system-style), it does not matter.
        'ja_JP', {
            localeMatcher => 'best fit',
            # The only one supported
            calendar => 'gregorian',
            numberingSystem => 'latn',
            hour12 => 0,
            timeZone => 'Asia/Tokyo',
            weekday => 'long',
            era => 'short',
lib/DateTime/Format/Intl.pm view on Meta::CPAN
The locale matching algorithm to use. Possible values are C<lookup> and C<best fit>; the default is C<best fit>. For information about this option, see L<Locale identification and negotiation|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re...
Whatever value you provide, does not actually have any influence on the algorithm used. C<best fit> will always be the one used.
=item * C<calendar>
The calendar to use, such as C<chinese>, C<gregorian> (or C<gregory>), C<persian>, and so on. For a list of calendar types, see L<Intl.Locale.prototype.getCalendars()|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/In...
For example, a Japanese locale with the C<japanese> calendar extension set:
    my $fmt = DateTime::Format::Intl->new( 'ja-Kana-JP-u-ca-japanese' );
The only value calendar type supported by this module is C<gregorian>. Any other value will return an error.
=item * C<numberingSystem>
The numbering system to use for number formatting, such as C<fullwide>, C<hant>, C<mathsans>, and so on. For a list of supported numbering system types, see L<getNumberingSystems()|Locale::Intl/getNumberingSystems>. This option can also be set throug...
lib/DateTime/Format/Intl.pm view on Meta::CPAN
The string used for the month, for example C<12>.
=item * C<relatedYear>
The string used for the related 4-digit Gregorian year, in the event that the calendar's representation would be a yearName instead of a year, for example C<2019>.
=item * C<second>
The string used for the second, for example C<07> or C<42>.
lib/DateTime/Format/Intl.pm view on Meta::CPAN
=item * C<locale>
The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in l...
=item * C<calendar>
E.g. C<gregory>
=item * C<numberingSystem>
view release on metacpan or search on metacpan
lib/DateTime/Format/Japanese.pm view on Meta::CPAN
=back
=head2 with_gregorian_marker()
Get/Set the option to include the gregorian calendar marker ("西æ¦")
=head2 with_bc_marker()
Get/Set the option to include the "B.C." marker instead of a negative year.
view release on metacpan or search on metacpan
generalized_time.txt view on Meta::CPAN
      MINUS           = %x2D  ; minus sign ("-")
   The <DOT>, <COMMA>, and <PLUS> rules are defined in [RFC4512].
   The above ABNF allows character strings that do not represent valid
   dates (in the Gregorian calendar) and/or valid times (e.g., February
   31, 1994).  Such character strings SHOULD be considered invalid for
   this syntax.
   The time value represents coordinated universal time (equivalent to
   Greenwich Mean Time) if the "Z" form of <g-time-zone> is used;
view release on metacpan or search on metacpan
lib/DateTime/Format/Unicode.pm view on Meta::CPAN
    }
}
# NOTE: pattern U
# Missing in DateTime
# "If the calendar does not provide cyclic year name data, or if the year value to be formatted is out of the range of years for which cyclic name data is provided, then numeric formatting is used (behaves like 'y')."
sub _format_cyclic_year_name
{
    my( $self, $token, $len, $dt ) = @_;
    my $unicode = $self->{_unicode} || die( "DateTime::Locale::FromCLDR object is gone!" );
    my $year = $dt->year;
lib/DateTime/Format/Unicode.pm view on Meta::CPAN
=item * C<b>
Period of the day, such as C<am>, C<pm>, C<noon>, C<midnight>
See L<Locale::Unicode::Data/calendar_term> and its corollary L<Locale::Unicode::Data/day_period>
=item * C<B>
Flexible day periods, such as C<at night>
See L<Locale::Unicode::Data/calendar_term> and its corollary L<Locale::Unicode::Data/day_period>
=item * C<O>
Zone, such as C<O> to get the short localized GMT format C<GMT-8>, or C<OOOO> to get the long localized GMT format C<GMT-08:00>
=item * C<r>
Related Gregorian year (numeric).
The documentation states that "For the Gregorian calendar, the ârâ year is the same as the âuâ year."
=item * C<U>
Cyclic year name. However, since this is for non gregorian calendars, like Chinese or Hindu calendars, and since L<DateTime> only supports gregorian calendar, we do not support it either.
=item * C<x>
Timezone, such as C<x> would be C<-08>, C<xx> C<-0800> or C<+0800>, C<xxx> would be C<-08:00> or C<+08:00>, C<xxxx> would be C<-0800> or C<+0000> and C<xxxxx> would be C<-08:00>, or C<-07:52:58> or C<+00:00>
view release on metacpan or search on metacpan
lib/DateTime/Incomplete.pm view on Meta::CPAN
A C<DateTime::Incomplete> object can have a "base" C<DateTime.pm>
object.  This object is used as a default datetime in the
C<to_datetime()> method, and it also used to validate inputs to the
C<set()> method.
The base object must use the year/month/day system.  Most calendars
use this system including Gregorian (C<DateTime>) and Julian.  Note
that this module has not been well tested with base objects from
classes other than C<DateTime.pm> class.
By default, newly created C<DateTime::Incomplete> objects have no
lib/DateTime/Incomplete.pm view on Meta::CPAN
=item * from_object( object => $object, ... )
This class method can be used to construct a new
C<DateTime::Incomplete> object from any object that implements the
C<utc_rd_values()> method.  All C<DateTime::Calendar> modules must
implement this method in order to provide cross-calendar
compatibility.  This method accepts a "locale" parameter.
If the object passed to this method has a C<time_zone()> method, that
is used to set the time zone.  Otherwise UTC is used.