Bug 13601: The fallback regex should contain the time part
On displaying a sql date, if the dateformat is not set to sql, the output should contain the date. In the previous version, the fallback regex (used for sql format) did not included the time part (hh:mm:ss). Checked out an item with due date an ddue time. Time displays as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
304ad760a3
commit
dc1eb56edf
|
|
@ -105,7 +105,7 @@ sub dt_from_string {
|
|||
}
|
||||
|
||||
# Add the faculative time part [hh:mm[:ss]]
|
||||
$regex .= qr|
|
||||
my $time_re .= qr|
|
||||
(
|
||||
\s*
|
||||
(?<hour>\d{2})
|
||||
|
|
@ -117,6 +117,8 @@ sub dt_from_string {
|
|||
)?
|
||||
)?
|
||||
|xms;
|
||||
$regex .= $time_re;
|
||||
$fallback_re .= $time_re;
|
||||
|
||||
my %dt_params;
|
||||
if ( $date_string =~ $regex ) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use DateTime;
|
|||
use DateTime::TimeZone;
|
||||
|
||||
use C4::Context;
|
||||
use Test::More tests => 54;
|
||||
use Test::More tests => 55;
|
||||
use Test::MockModule;
|
||||
use Time::HiRes qw/ gettimeofday /;
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -211,3 +211,7 @@ is( output_pref( { dt => $dt } ), '31/01/2015 12:34', 'dt_from_string should mat
|
|||
# date before 1900
|
||||
$dt = dt_from_string('01/01/1900');
|
||||
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
|
||||
|
||||
# fallback
|
||||
$dt = dt_from_string('2015-01-31 01:02:03');
|
||||
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue