Skip to content
Browse files

Working on getting DateTime::Math working in nom.

  • Loading branch information...
1 parent 8967e9d commit 21a61d9ca0d53dd1db30257b347eaa47e096debd @supernovus committed Jan 16, 2012
Showing with 4 additions and 9 deletions.
  1. +4 −9 lib/DateTime/Math.pm6
View
13 lib/DateTime/Math.pm6
@@ -72,26 +72,21 @@ sub duration-from-to( Numeric $value, DurationUnits $in, DurationUnits $to)
from-seconds(to-seconds($value, $in), $to);
}
-multi infix:<+>(DateTime $dt, Numeric $x) is export {
+multi infix:<+>(DateTime:D $dt, Numeric:D $x) is export {
$*ERR.say: "We're in the proper addition routine.";
DateTime.new(($dt.posix + $x).Int, :timezone($dt.timezone), :formatter($dt.formatter))
}
-multi infix:<+>(Numeric $x, DateTime $dt) is export {
+multi infix:<+>(Numeric:D $x, DateTime:D $dt) is export {
$dt + $x;
}
-multi infix:<->(DateTime $dt, Int $x) is export {
- $*ERR.say: "We're in the Int version.";
- DateTime.new(($dt.posix - $x).Int, :timezone($dt.timezone), :formatter($dt.formatter))
-}
-
-multi infix:<->(DateTime $dt, Numeric $x) is export {
+multi infix:«-»(DateTime:D $dt, Numeric:D $x) is export {
$*ERR.say: "We're in the proper substraction routine.";
DateTime.new(($dt.posix - $x).Int, :timezone($dt.timezone), :formatter($dt.formatter))
}
-multi infix:<->(DateTime $a, DateTime $b) is export {
+multi infix:<->(DateTime:D $a, DateTime:D $b) is export {
$a.posix - $b.posix;
}

0 comments on commit 21a61d9

Please sign in to comment.
Something went wrong with that request. Please try again.