Skip to content

Commit

Permalink
Only integers live in these lookup lists
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 23, 2016
1 parent 08a7603 commit c3446c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/Dateish.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ my role Dateish {
multi method is-leap-year(Dateish:D:) { IS-LEAP-YEAR($!year) }
multi method is-leap-year(Dateish: $y) { IS-LEAP-YEAR($y) }

my $days-in-month := nqp::list(
my $days-in-month := nqp::list_i(
0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
);
method !DAYS-IN-MONTH(\year, \month) {
nqp::atpos($days-in-month,month) ||
nqp::atpos_i($days-in-month,month) ||
( month == 2 ?? 28 + IS-LEAP-YEAR(year) !! Nil );
}
proto method days-in-month(|) { * }
Expand Down Expand Up @@ -105,12 +105,12 @@ my role Dateish {
($!day - 1) div 7 + 1
}

my $days-at-start-of-month := nqp::list(
my $days-at-start-of-month := nqp::list_i(
0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
);
method day-of-year() {
$!day
+ nqp::atpos($days-at-start-of-month,$!month)
+ nqp::atpos_i($days-at-start-of-month,$!month)
+ ($!month > 2 && IS-LEAP-YEAR($!year));
}

Expand Down

0 comments on commit c3446c0

Please sign in to comment.