Skip to content

Instantly share code, notes, and snippets.

@moritz
Created July 29, 2012 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/3200120 to your computer and use it in GitHub Desktop.
Save moritz/3200120 to your computer and use it in GitHub Desktop.
Perl 6 related release dates
use v6;
sub parrot-release-after(Date $date is copy = Date.today) {
$date++ until $date.day-of-week == 2;
$date += 7 until ($date - $date.truncated-to(:month)) div 7 == 2;
$date;
}
sub rakudo-release-after(Date $date = Date.today) {
parrot-release-after($date) + 2;
}
sub niecza-release-after(Date $date = Date.today) {
my $d = $date.truncated-to(:week);
$d += 7 while $d.month == ($d + 7).month;
$d;
}
say 'parrot: ', parrot-release-after;
say 'rakudo: ', rakudo-release-after;
say 'niecza: ', niecza-release-after;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment