projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3572290
)
DateTime: neue Funktion end_of_month
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 23 Sep 2015 07:11:43 +0000
(09:11 +0200)
committer
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 23 Sep 2015 12:32:00 +0000
(14:32 +0200)
Setzt $self auf den Start des letzten Tags eines Monats.
SL/Helper/DateTime.pm
patch
|
blob
|
history
diff --git
a/SL/Helper/DateTime.pm
b/SL/Helper/DateTime.pm
index
138a8f3
..
547c4b9
100644
(file)
--- 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<to_kivitendo>).
The legacy name C<from_lxoffice> is still supported.
+=item C<end_of_month>
+
+Sets the object to the last day of object's month at midnight. Returns
+the object itself.
+
=back
=head1 AUTHOR