Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[core/Temporal.pm] explicitly create a DefaultFormatter where implici…
…tly was not doing it
  • Loading branch information
Martin Berends committed Apr 12, 2010
1 parent 0334df6 commit fd40e2a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/core/Temporal.pm
Expand Up @@ -17,10 +17,12 @@ class DateTime {

has $.time_zone = '+0000';

has DateTime::Formatter $!formatter = DefaultFormatter.new;
has DateTime::Formatter $!formatter; # = DefaultFormatter.new;

multi method new(:$year!, *%_) {
self.bless(*, :$year, |%_);
self.bless(*, :$year,
:formatter( DefaultFormatter.new ),
|%_);
}

multi method new(Str $format) {
Expand Down Expand Up @@ -65,7 +67,7 @@ class DateTime {
}

multi method now() {
self.from_epoch(time());
self.from_epoch(:epoch(time()), :formatter(DefaultFormatter.new) );
}

multi method ymd($sep = '-') {
Expand All @@ -76,12 +78,8 @@ class DateTime {
($!hour, $!minute, $!second).fmt('%02d', $sep);
}

multi method datetime() {
self.ymd ~ 'T' ~ self.hms;
}

method iso8601() {
self.datetime() ~ $!time_zone;
self.ymd ~ 'T' ~ self.hms ~ $!time_zone;
}

method Str() {
Expand Down

0 comments on commit fd40e2a

Please sign in to comment.