Skip to content

Commit

Permalink
Merge pull request #285 from carbin/nom
Browse files Browse the repository at this point in the history
[Temporal] accept colon in the timezone offset
  • Loading branch information
FROGGS committed Jul 8, 2014
2 parents 9013d8f + db37b6f commit 597f35f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Temporal.pm
Expand Up @@ -251,7 +251,7 @@ my class DateTime does Dateish {
}

multi method new(Str $format, :$timezone is copy = 0, :&formatter=&default-formatter) {
$format ~~ /^ (\d**4) '-' (\d\d) '-' (\d\d) T (\d\d) ':' (\d\d) ':' (\d\d) (Z || (<[\-\+]>) (\d\d)(\d\d))? $/
$format ~~ /^ (\d**4) '-' (\d\d) '-' (\d\d) T (\d\d) ':' (\d\d) ':' (\d\d) (Z || (<[\-\+]>) (\d\d) (':'? (\d\d))? )? $/
or X::Temporal::InvalidFormat.new(
invalid-str => $format,
target => 'DateTime',
Expand All @@ -269,7 +269,7 @@ my class DateTime does Dateish {
if $6 eq 'Z' {
$timezone = 0;
} else {
$timezone = (($6[1]*60 + $6[2]) * 60).Int;
$timezone = (($6[1]*60 + ($6[2][0] // 0)) * 60).Int;
# RAKUDO: .Int is needed to avoid to avoid the nasty '-0'.
$6[0] eq '-' and $timezone = -$timezone;
}
Expand Down

0 comments on commit 597f35f

Please sign in to comment.