Rick Measham > DateTime-Event-Easter-1.04 > DateTime::Event::Easter

Download:
DateTime-Event-Easter-1.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Module Version: 1.04   Source  

NAME ^

DateTime::Event::Easter - Returns Easter events for DateTime objects

SYNOPSIS ^

  use DateTime::Event::Easter;
  
  $dt = DateTime->new( year   => 2002,
                       month  => 3,
                       day    => 31,
                     );
  
  
  $easter_sunday = DateTime::Event::Easter->new();

  $previous_easter_sunday = $easter_sunday->previous($dt);
  # Sun, 15 Apr 2001 00:00:00 UTC
  
  $following_easter_sunday = $easter_sunday->following($dt);
  # Sun, 20 Apr 2003 00:00:00 UTC
  
  $closest_easter_sunday = $easter_sunday->closest($dt);
  # Sun, 31 Mar 2002 00:00:00 UTC
  
  $is_easter_sunday = $easter_sunday->is($dt);
  # 1
  
  $palm_sunday = DateTime::Event::Easter->new(day=>'Palm Sunday');


  $dt2 = DateTime->new( year   => 2060,
                        month  => 4,
                        day    => 30,
                      );
  
  @set = $palm_sunday->as_list(from=>$dt, to=>$dt2, inclusive=>1);
  # Sun, 13 Apr 2003 00:00:00 UTC
  # Sun, 04 Apr 2004 00:00:00 UTC
  # Sun, 20 Mar 2005 00:00:00 UTC
  # Sun, 09 Apr 2006 00:00:00 UTC
  
  $datetime_set = $palm_sunday->as_set;
  # A set of every Palm Sunday ever. See C<DateTime::Set> for more information.

DESCRIPTION ^

The DateTime::Event::Easter module returns Easter events for DateTime objects. From a given datetime, it can tell you the previous, the following and the closest Easter event. The 'is' method will tell you if the given DateTime is an Easter Event.

Easter Events can be Palm Sunday, Maundy Thursday, Good Friday, Black Saturday and Easter Sunday. If that's not enough, the module will also accept an offset so you can get the date for Pentecost (49 days after Easter Sunday) by passing 49.

BACKGROUND ^

Easter Sunday is the Sunday following the first full moon on or following the Official Vernal Equinox. The Official Vernal Equinox is 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 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.

CONSTRUCTOR ^

This class accepts the following options to its 'new' constructor:

METHODS ^

For all these methods, unless otherwise noted, $dt is a plain vanila DateTime object or a DateTime object from any DateTime::Calendar module that can handle calls to from_object and utc_rd_values (which should be all of them, but there's nothing stopping someone making a bad egg).

This class offers the following methods.

EXPORTS ^

This class does not export any methods by default, however the following exports are supported.

THE SMALL PRINT ^

REFERENCES

SUPPORT

Support for this module, and for all DateTime modules will be given through the DateTime mailing list - datetime@perl.org.

Bugs should be reported through rt.cpan.org.

AUTHOR

Rick Measham <rickm@cpan.org>

CREDITS

Much help from the DateTime mailing list, especially from:

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

Dave Rolsky - who picked nits, designed DateTime itself and leads the project

Martin Hasch - who pointed out the posibility of memory leak with an early beta

COPYRIGHT

(c) Copyright 2003 Rick Measham. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

DateTime, DateTime::Calendar::Easter, perl(1), http://datetime.perl.org.

syntax highlighting: