Skip to content

Commit

Permalink
be a little more liberal with RFC 3339 date and time separators
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 28, 2014
1 parent 874b85f commit aace17e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/ByteStream.pm
Expand Up @@ -357,7 +357,7 @@ Always true.
my $str = "$bytestream";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Cookie.pm
Expand Up @@ -79,7 +79,7 @@ Always true.
my $str = "$cookie";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Date.pm
Expand Up @@ -7,8 +7,8 @@ use Time::Local 1.2 'timegm';
has epoch => sub {time};

my $RFC3339_RE = qr/
^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+(?:\.\d+)?) # Date and time
(?:Z|([+-])(\d+):(\d+))?$ # Offset
^(\d+)-(\d+)-(\d+)\D+(\d+):(\d+):(\d+(?:\.\d+)?) # Date and time
(?:Z|([+-])(\d+):(\d+))?$ # Offset
/xi;

my @DAYS = qw(Sun Mon Tue Wed Thu Fri Sat);
Expand Down Expand Up @@ -184,7 +184,7 @@ Always true.
my $str = "$date";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Exception.pm
Expand Up @@ -213,7 +213,7 @@ Always true.
my $str = "$e";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Home.pm
Expand Up @@ -185,7 +185,7 @@ Always true.
my $str = "$home";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/URL.pm
Expand Up @@ -437,7 +437,7 @@ Always true.
my $str = "$url";
Alias for L</to_string>.
Alias for L</"to_string">.
=head1 SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions t/mojo/date.t
Expand Up @@ -30,6 +30,8 @@ is(Mojo::Date->new('1994-11-06T08:49:37Z')->epoch,
784111777, 'right epoch value');
is(Mojo::Date->new('1994-11-06t08:49:37.33z')->epoch,
784111777.33, 'right epoch value');
is(Mojo::Date->new('2014-08-20 20:45:00')->epoch,
1408567500, 'right epoch value');
is(Mojo::Date->new(784111777.33)->to_datetime,
'1994-11-06T08:49:37.33Z', 'right format');

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/json_pointer.t
Expand Up @@ -51,7 +51,7 @@ is $pointer->new([{'f~o~o~/b~' => {'a~' => {'r' => 'baz'}}}])
# Unicode
is $pointer->new({'' => 'snowman'})->get('/☃'), 'snowman',
'found the snowman';
is $pointer->new({'' => ['snowman']})->get('/☃/0'), 'snowman',
is $pointer->new->data({'' => ['snowman']})->get('/☃/0'), 'snowman',
'found the snowman';

# RFC 6901
Expand Down

0 comments on commit aace17e

Please sign in to comment.