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

(-)a/Koha/DateUtils.pm (-6 / +6 lines)
Lines 72-88 sub dt_from_string { Link Here
72
        my $fallback_re = qr|
72
        my $fallback_re = qr|
73
            (?<year>\d{4})
73
            (?<year>\d{4})
74
            -
74
            -
75
            (?<month>\d{2})
75
            (?<month>\d{1,2})
76
            -
76
            -
77
            (?<day>\d{2})
77
            (?<day>\d{1,2})
78
        |xms;
78
        |xms;
79
        if ( $date_format eq 'metric' ) {
79
        if ( $date_format eq 'metric' ) {
80
            # metric format is "dd/mm/yyyy[ hh:mm:ss]"
80
            # metric format is "dd/mm/yyyy[ hh:mm:ss]"
81
            $regex = qr|
81
            $regex = qr|
82
                (?<day>\d{2})
82
                (?<day>\d{1,2})
83
                /
83
                /
84
                (?<month>\d{2})
84
                (?<month>\d{1,2})
85
                /
85
                /
86
                (?<year>\d{4})
86
                (?<year>\d{4})
87
            |xms;
87
            |xms;
Lines 90-98 sub dt_from_string { Link Here
90
        elsif ( $date_format eq 'us' ) {
90
        elsif ( $date_format eq 'us' ) {
91
            # us format is "mm/dd/yyyy[ hh:mm:ss]"
91
            # us format is "mm/dd/yyyy[ hh:mm:ss]"
92
            $regex = qr|
92
            $regex = qr|
93
                (?<month>\d{2})
93
                (?<month>\d{1,2})
94
                /
94
                /
95
                (?<day>\d{2})
95
                (?<day>\d{1,2})
96
                /
96
                /
97
                (?<year>\d{4})
97
                (?<year>\d{4})
98
            |xms;
98
            |xms;
(-)a/t/DateUtils.t (-1 / +4 lines)
Lines 189-191 is( output_pref( { dt => $dt } ), '31/01/2015 12:34', 'dt_from_string should mat Link Here
189
# date before 1900
189
# date before 1900
190
$dt = dt_from_string('01/01/1900');
190
$dt = dt_from_string('01/01/1900');
191
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
191
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
192
--
192
193
# missing 0
194
$dt = dt_from_string('1/1/2015');
195
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/2015', 'dt_from_string should generate a DT object even if 0 are missing' );
193
acqui/basket.pl | 2 +-
196
acqui/basket.pl | 2 +-
194
1 file changed, 1 insertion(+), 1 deletion(-)
197
1 file changed, 1 insertion(+), 1 deletion(-)
(-)a/acqui/basket.pl (-2 / +1 lines)
Lines 312-318 if ( $op eq 'delete_confirm' ) { Link Here
312
    if( $basket->{closedate} ) {
312
    if( $basket->{closedate} ) {
313
        my ($year, $month, $day) = ($basket->{closedate} =~ /(\d+)-(\d+)-(\d+)/);
313
        my ($year, $month, $day) = ($basket->{closedate} =~ /(\d+)-(\d+)-(\d+)/);
314
        ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $bookseller->{deliverytime});
314
        ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $bookseller->{deliverytime});
315
        $estimateddeliverydate = "$year-$month-$day";
315
        $estimateddeliverydate = sprintf( "%04d-%02d-%02d", $year, $month, $day );
316
    }
316
    }
317
317
318
    # if new basket, pre-fill infos
318
    # if new basket, pre-fill infos
319
- 

Return to bug 13601