Bugzilla – Attachment 68848 Details for
Bug 19176
Dates comparison fails on slow server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19176: Fix how t::lib::Dates::compare handle timezone
Bug-19176-Fix-how-tlibDatescompare-handle-timezone.patch (text/plain), 2.11 KB, created by
Julian Maurice
on 2017-10-30 14:42:09 UTC
(
hide
)
Description:
Bug 19176: Fix how t::lib::Dates::compare handle timezone
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2017-10-30 14:42:09 UTC
Size:
2.11 KB
patch
obsolete
>From 8efa00bb54e48637ae295811cb906694c48716a9 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 30 Oct 2017 14:41:47 +0000 >Subject: [PATCH] Bug 19176: Fix how t::lib::Dates::compare handle timezone > >--- > t/Test/Dates.t | 11 +++++++---- > t/lib/Dates.pm | 2 -- > 2 files changed, 7 insertions(+), 6 deletions(-) > >diff --git a/t/Test/Dates.t b/t/Test/Dates.t >index 78206e2fc0..4857e278c5 100644 >--- a/t/Test/Dates.t >+++ b/t/Test/Dates.t >@@ -1,5 +1,5 @@ > use Modern::Perl; >-use Test::More tests => 7; >+use Test::More tests => 8; > use t::lib::Dates; > use Koha::DateUtils qw( dt_from_string ); > >@@ -20,7 +20,10 @@ is( t::lib::Dates::compare( $dt_1, $dt_3 ), > is( t::lib::Dates::compare( $dt_3, $dt_1 ), > 0, 'If there is less than 1min, the dates are considered identicals' ); > >-$dt_1->set_time_zone('+0000'); >-$dt_3 = $dt_1->clone->set_time_zone('+0400'); >+$dt_1 = DateTime->new(year => 2001, month => 1, day => 1, hour => 0, minute => 0, second => 0, time_zone => '+0000'); >+$dt_3 = DateTime->new(year => 2001, month => 1, day => 1, hour => 4, minute => 0, second => 0, time_zone => '+0400'); >+is( t::lib::Dates::compare( $dt_1, $dt_3 ), 0, 'Different timezone but same date/time' ); > >-is( t::lib::Dates::compare( $dt_1, $dt_3 ), -1, "Compare different timezones" ); >+$dt_1 = DateTime->new(year => 2001, month => 1, day => 1, hour => 0, minute => 0, second => 0, time_zone => '+0000'); >+$dt_3 = DateTime->new(year => 2001, month => 1, day => 1, hour => 0, minute => 0, second => 0, time_zone => '+0400'); >+is( t::lib::Dates::compare( $dt_1, $dt_3 ), 1, 'Different timezone and different date/time' ); >diff --git a/t/lib/Dates.pm b/t/lib/Dates.pm >index 1aa1adc233..330d5c58a1 100644 >--- a/t/lib/Dates.pm >+++ b/t/lib/Dates.pm >@@ -24,8 +24,6 @@ sub compare { > my ( $got, $expected, $description ) = @_; > my $dt_got = dt_from_string($got); > my $dt_expected = dt_from_string($expected); >- $dt_got->set_time_zone('floating'); >- $dt_expected->set_time_zone('floating'); > my $diff = $dt_got->epoch - $dt_expected->epoch; > if ( abs($diff) < 6 ) { return 0 } > return $diff > 0 ? 1 : -1; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19176
:
66493
|
66563
|
67322
|
68082
|
68412
|
68413
|
68414
|
68448
|
68449
|
68450
| 68848 |
68923