Skip to content

Commit

Permalink
RT #125683: Validate minutes in timezone string
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jul 26, 2015
1 parent 6c2ad86 commit ed945eb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/Temporal.pm
Expand Up @@ -276,6 +276,13 @@ my class DateTime does Dateish {
if $6 eq 'Z' {
$timezone = 0;
} else {
if $6[2] && $6[2][0] > 59 {
X::OutOfRange.new(
what => "minutes of timezone",
got => +$6[2][0],
range => 0..59,
).throw;
}
$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 ed945eb

Please sign in to comment.