Lines 144-150
like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string sh
Link Here
|
144 |
|
144 |
|
145 |
# ISO string tests |
145 |
# ISO string tests |
146 |
subtest 'dt_from_string - iso format' => sub { |
146 |
subtest 'dt_from_string - iso format' => sub { |
147 |
plan tests => 5; |
147 |
plan tests => 7; |
148 |
|
148 |
|
149 |
my $module_context = Test::MockModule->new('C4::Context'); |
149 |
my $module_context = Test::MockModule->new('C4::Context'); |
150 |
$module_context->mock( |
150 |
$module_context->mock( |
Lines 175-182
subtest 'dt_from_string - iso format' => sub {
Link Here
|
175 |
# Sunday January 01, 2012 23:59:59 (UTC) |
175 |
# Sunday January 01, 2012 23:59:59 (UTC) |
176 |
|
176 |
|
177 |
$dt_iso = dt_from_string( '2012-01-01T23:59:59+02:00', 'iso' ); |
177 |
$dt_iso = dt_from_string( '2012-01-01T23:59:59+02:00', 'iso' ); |
178 |
cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset' ); |
178 |
cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset +02:00' ); |
179 |
# Sunday January 01, 2012 21:59:59 (UTC) == Sunday January 01, 2012 23:59:59 Europe/Athens (EET/+02:00) |
179 |
# Sunday January 01, 2012 21:59:59 (UTC) == Sunday January 01, 2012 23:59:59 Europe/Athens (EET/+02:00) |
|
|
180 |
# Allow +02 or +0200 too |
181 |
$dt_iso = dt_from_string( '2012-01-01T23:59:59+02', 'iso' ); |
182 |
cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset +02' ); |
183 |
$dt_iso = dt_from_string( '2012-01-01T23:59:59+0200', 'iso' ); |
184 |
cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset +0200' ); |
185 |
|
180 |
}; |
186 |
}; |
181 |
|
187 |
|
182 |
# Return undef if passed mysql 0 dates |
188 |
# Return undef if passed mysql 0 dates |
183 |
- |
|
|