DateTime-Moonpig
    
    
  
  
  
view release on metacpan or search on metacpan
lib/DateTime/Moonpig.pm view on Meta::CPAN
When two time objects are subtracted, the result is normally a number.
However, the numeric difference is first passed to the target object's
C<interval_factory> method, which has the option to transform it and
return an object (or something else) instead.  The default
C<interval_factory> returns its argument unchanged.  So for example,
        $z0   = $x0 - $birthday;       # 10
is actually returning the result of C<< $x0->interval_factory(10) >>, which is 10.
=head3 Absolute time, not calendar time
C<DateTime::Moonpig> C<plus> and C<minus> always do real-time calculations, never civil
calendar calculations.  If your locality began observing daylight
savings on 2007-03-11, as most of the USA did, then:
        $a_day    = DateTime::Moonpig->new( year   => 2007,
                                            month  =>    3,
                                            day    =>   11,
                                            hour   =>    1,
                                            minute =>    0,
                                            second =>    0,
                                            time_zone => "America/New_York",
                                          );
	$next_day = $a_day->plus(24*3600);
At this point C<$next_day> is exactly 24E<middot>3600 seconds ahead
of C<$a_day>. Because the civil calendar day for 2007-03-11 in New
York was only 23 hours long, C<$next_day> represents represents
2007-03-12 02:00:00 instead of 2007-03-12 01:00:00. This should be what you
expect; if not please correct your expectation.
=head2 NEW METHODS
=head3 C<new_datetime>
C<< DateTime::Moonpig->new_datetime( $dt ) >> takes a C<DateTime> object and
returns an equivalent C<DateTime::Moonpig> object.
( run in 0.303 second using v1.01-cache-2.11-cpan-5dc5da66d9d )