Skip to content

Commit

Permalink
Date.new should not die with LTA error
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Apr 10, 2012
1 parent 3bd91f5 commit b8fdbea
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Temporal.pm
Expand Up @@ -423,6 +423,15 @@ my class Date does Dateish {
self.new(|$date.split('-').map({.Int})); self.new(|$date.split('-').map({.Int}));
} }


multi method new() {
my $n = self.today;
if $n.month == 12 && $n.day >= 24 {
Date.new($n.year + 1, 12, 24);
} else {
Date.new($n.year, 12, 24);
}
}

multi method new(DateTime $dt) { multi method new(DateTime $dt) {
self.bless(*, self.bless(*,
:year($dt.year), :month($dt.month), :day($dt.day), :year($dt.year), :month($dt.month), :day($dt.day),
Expand Down

0 comments on commit b8fdbea

Please sign in to comment.