Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[S32-temporal] add tests for more timezone offsets
Per ISO 8601 timezone offsets can be colonated and minuteless
  • Loading branch information
cbvi committed Jul 8, 2014
1 parent d2f0d4f commit 8cc408b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion S32-temporal/DateTime.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 201;
plan 205;

my $orwell = DateTime.new(year => 1984);

Expand Down Expand Up @@ -210,6 +210,12 @@ is DateTime.new('2009-12-31T22:33:44',
formatter => { ($^dt.hour % 12) ~ 'ish' } ),
'10ish', 'DateTime.new(Str) with formatter';

# additional timezone offset formats that are acceptable per ISO 8601
is ds('2012-12-22T07:02:00+12'), '2012-12-22T07:02:00+1200', 'offset with no minutes specified';
is ds('2012-12-22T07:02:00+12:00'), '2012-12-22T07:02:00+1200', 'colonated offset';
is ds('2012-12-22T07:02:00+12:45'), '2012-12-22T07:02:00+1245', 'colonated non-zero offset';
dies_ok { ds('2012-12-22T07:02:00+12:') }, 'trailing colon causes death';

# --------------------------------------------------------------------
# L<S32::Temporal/C<DateTime>/'truncated-to'>
# --------------------------------------------------------------------
Expand Down

0 comments on commit 8cc408b

Please sign in to comment.