From: Chris W. <la...@us...> - 2005-02-25 05:36:26
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23782 Modified Files: Context.pm Log Message: allow 'create_date()' to take a 'last_day_of_month' parameter to use that constructor instead of 'new()' Index: Context.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Context.pm,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Context.pm 19 Feb 2005 04:26:04 -0000 1.84 --- Context.pm 25 Feb 2005 05:35:59 -0000 1.85 *************** *** 286,299 **** my ( $self, $params ) = @_; $params ||= {}; ! if ( $params->{year} ) { ! return DateTime->new( time_zone => $self->timezone_object, ! %{ $params } ); } ! elsif ( $params->{epoch} ) { ! return DateTime->from_epoch( time_zone => $self->timezone_object, ! epoch => $params->{epoch}, ); } --- 286,306 ---- my ( $self, $params ) = @_; $params ||= {}; ! if ( $params->{epoch} ) { ! return DateTime->from_epoch( time_zone => $self->timezone_object, ! epoch => $params->{epoch}, ); } ! elsif ( $params->{last_day_of_month} ) { ! delete $params->{last_day_of_month}; ! return DateTime->last_day_of_month( time_zone => $self->timezone_object, ! %{ $params }, ! ); ! } ! elsif ( $params->{year} ) { ! return DateTime->new( ! time_zone => $self->timezone_object, ! %{ $params } ); } *************** *** 1064,1069 **** and call the L<DateTime> C<now()> method. ! The exception: when you specify 'epoch' in C<\%params> we call the ! C<from_epoch()> method instead of the constructor. This is just a shortcut method and you instead may want to get the --- 1071,1089 ---- and call the L<DateTime> C<now()> method. ! The exceptions: ! ! =over 4 ! ! =item * ! ! when you specify 'epoch' in C<\%params> we call the C<from_epoch()> ! constructorinstead of C<new()>. ! ! =item * ! ! when you specify 'last_day_of_month' in C<\%params> we call the ! C<last_day_of_month()> constructor instead of C<new()>. ! ! =back This is just a shortcut method and you instead may want to get the |