Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add .Date/.DateTime coercers to Instant
  • Loading branch information
lizmat committed Dec 8, 2015
1 parent c60f405 commit 9476601
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/core/Instant.pm
@@ -1,3 +1,5 @@
my class Date { ... }
my class DateTime { ... }
my class Duration {... }

my class Instant is Cool does Real {
Expand Down Expand Up @@ -52,6 +54,9 @@ my class Instant is Cool does Real {
method Int (Instant:D:) { $.tai.Int }
method narrow(Instant:D:) { $.tai.narrow }

method Date(Instant:D:) { Date.new(self) }
method DateTime(Instant:D: |c) { DateTime.new(self, |c) }

# TODO: should be the new .gist, probably
# method Str() {
# 'Instant:' ~ default-formatter
Expand Down
3 changes: 0 additions & 3 deletions src/core/Temporal.pm
@@ -1,6 +1,3 @@
my class DateTime { ... }
my class Date { ... }

my role Dateish {
has Int $.year;
has Int $.month = 1;
Expand Down

0 comments on commit 9476601

Please sign in to comment.