diff --git a/lib/LedgerSMB.pm b/lib/LedgerSMB.pm index 5467bfb6f9..6c8af5a83e 100644 --- a/lib/LedgerSMB.pm +++ b/lib/LedgerSMB.pm @@ -216,6 +216,10 @@ Parses the $date given the session user's date formatting settings. formats the $amount given the session user's number formatting settings. +=item format_date($date, %args) + +formats the $date given the session user's date formatting settings. + =item formatter_options() Returns a hashref containing the session user's number and date formatting @@ -774,6 +778,16 @@ sub format_amount { ); } +sub format_date { + my ($request, $date, %args) = @_; + my $config = $request->{_user}; + + return $date->to_output( + format => $config->{dateformat}, + %args + ); +} + sub formatter_options { my ($request) = @_; my $config = $request->{_user}; diff --git a/lib/LedgerSMB/Scripts/payment.pm b/lib/LedgerSMB/Scripts/payment.pm index 92567558e2..619b77a98d 100644 --- a/lib/LedgerSMB/Scripts/payment.pm +++ b/lib/LedgerSMB/Scripts/payment.pm @@ -1017,7 +1017,7 @@ sub payment2 { my @topay_state; my @open_invoices = $Payment->get_open_invoices(); for my $invoice (@open_invoices) { - $invoice->{invoice_date} = $request->format_amount( $invoice->{invoice_date} ); + $invoice->{invoice_date} = $request->format_date( $invoice->{invoice_date} ); if ($args{update} && ! $request->{"checkbox_$invoice->{invoice_id}"}) {