From: Moritz Bunkus Date: Wed, 23 Sep 2015 07:11:43 +0000 (+0200) Subject: DateTime: neue Funktion end_of_month X-Git-Tag: release-3.4.1~715 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a8b18c65bfd47c845e641fb0fff9587f4122bf9d;p=kivitendo-erp.git DateTime: neue Funktion end_of_month Setzt $self auf den Start des letzten Tags eines Monats. --- diff --git a/SL/Helper/DateTime.pm b/SL/Helper/DateTime.pm index 138a8f3f4..547c4b94b 100644 --- a/SL/Helper/DateTime.pm +++ b/SL/Helper/DateTime.pm @@ -77,6 +77,11 @@ sub subtract_businessdays { $self->add_business_duration(%params); } +sub end_of_month { + my ($self) = @_; + return $self->truncate(to => 'month')->add(months => 1)->subtract(days => 1); +} + 1; __END__ @@ -121,6 +126,11 @@ component (as opposed to L). The legacy name C is still supported. +=item C + +Sets the object to the last day of object's month at midnight. Returns +the object itself. + =back =head1 AUTHOR