Commit 8f68dad1 authored by David Cook's avatar David Cook Committed by Tomas Cohen Arazi

Bug 11244: (follow-up) Fix $dateonly flag

At the moment, $dateonly is set to true when $1 is defined. However,
since the regex capture group only includes the time, this flag will
only be set when there is a value that includes a time.

In effect, this means that timestamps are reduced to dates only,
while dates have 00-00-0000 added to them.

This patch keeps the logic but reverses the values, so that $dateonly
will default to true unless $1 is defined.
Signed-off-by: default avatarKyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: joubu's avatarJonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
parent 7605f91f
......@@ -622,7 +622,7 @@ sub _parseletter {
my $replacedby = defined ($val) ? $val : '';
if ( $replacedby and $replacedby =~ m|^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$| ) {
# If the value is XXXX-YY-ZZ[ AA:BB:CC] we assume it is a date
my $dateonly = defined $1 ? 1 : 0;
my $dateonly = defined $1 ? 0 : 1; #$1 refers to the capture group wrapped in parentheses. In this case, that's the hours, minutes, seconds.
eval {
$replacedby = output_pref({ dt => dt_from_string( $replacedby ), dateonly => $dateonly });
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment