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 141-147 sub dt_from_string { Link Here
141
                )?
142
                )?
142
            )?
143
            )?
143
    |xms;
144
    |xms;
144
    $regex .= $time_re;
145
    $regex .= $time_re unless ( $date_format eq 'rfc3339' );
145
    $fallback_re .= $time_re;
146
    $fallback_re .= $time_re;
146
147
147
    my %dt_params;
148
    my %dt_params;
Lines 157-163 sub dt_from_string { Link Here
157
        if ( $+{offset} ) {
158
        if ( $+{offset} ) {
158
            $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} );
159
            $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} );
159
        }
160
        }
160
    } elsif ( $date_string =~ $fallback_re ) {
161
    } elsif ( $do_fallback && $date_string =~ $fallback_re ) {
161
        %dt_params = (
162
        %dt_params = (
162
            year   => $+{year},
163
            year   => $+{year},
163
            month  => $+{month},
164
            month  => $+{month},
164
- 

Return to bug 24850