From: Moritz Bunkus Date: Tue, 8 Dec 2015 10:44:39 +0000 (+0100) Subject: Locale::parse_date_to_object: "yesterday" und "today" als Angaben unterstützen X-Git-Tag: release-3.4.1~550 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0ffc7f6beb4b051996c5738d02060e44e3fcaf22;p=kivitendo-erp.git Locale::parse_date_to_object: "yesterday" und "today" als Angaben unterstützen --- diff --git a/SL/Locale.pm b/SL/Locale.pm index 25e804333..8dc95e73c 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -394,6 +394,9 @@ sub parse_date_to_object { return undef if !defined $string; + return DateTime->today_local if lc($string) eq 'today'; + return DateTime->today_local->subtract(days => 1) if lc($string) eq 'yesterday'; + $params{dateformat} ||= $::myconfig{dateformat} || 'yy-mm-dd'; $params{numberformat} ||= $::myconfig{numberformat} || '1,000.00'; my $num_separator = $params{numberformat} =~ m{,\d+$} ? ',' : '.';