View | Details | Raw Unified | Return to bug 24850
Collapse All | Expand All

(-)a/Koha/DateUtils.pm (-4 / +4 lines)
Lines 53-58 sub dt_from_string { Link Here
53
53
54
    return if $date_string and $date_string =~ m|^0000-0|;
54
    return if $date_string and $date_string =~ m|^0000-0|;
55
55
56
    my $do_fallback = defined($date_format) ? 0 : 1;
56
    $tz = C4::Context->tz unless $tz;;
57
    $tz = C4::Context->tz unless $tz;;
57
58
58
    return DateTime->now( time_zone => $tz ) unless $date_string;
59
    return DateTime->now( time_zone => $tz ) unless $date_string;
Lines 117-123 sub dt_from_string { Link Here
117
            (?<minute>\d{2})
118
            (?<minute>\d{2})
118
            :
119
            :
119
            (?<second>\d{2})
120
            (?<second>\d{2})
120
            (\.\d{1,3})?(([Zz])|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9])))
121
            (\.\d{1,3})?(([Zz]$)|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9])))
121
        /xms;
122
        /xms;
122
    }
123
    }
123
    elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) {
124
    elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) {
Lines 145-151 sub dt_from_string { Link Here
145
                )?
146
                )?
146
            )?
147
            )?
147
    |xms;
148
    |xms;
148
    $regex .= $time_re;
149
    $regex .= $time_re unless ( $date_format eq 'rfc3339' );
149
    $fallback_re .= $time_re;
150
    $fallback_re .= $time_re;
150
151
151
    my %dt_params;
152
    my %dt_params;
Lines 163-169 sub dt_from_string { Link Here
163
        if ( $+{offset} ) {
164
        if ( $+{offset} ) {
164
            $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} );
165
            $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} );
165
        }
166
        }
166
    } elsif ( $date_string =~ $fallback_re ) {
167
    } elsif ( $do_fallback && $date_string =~ $fallback_re ) {
167
        %dt_params = (
168
        %dt_params = (
168
            year   => $+{year},
169
            year   => $+{year},
169
            month  => $+{month},
170
            month  => $+{month},
170
- 

Return to bug 24850