Skip to content

Commit

Permalink
better description for to_words
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 28, 2014
1 parent 45b9dd3 commit 0914bba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Mojo/Date.pm
Expand Up @@ -75,9 +75,8 @@ sub to_string {

sub to_words {
my $self = shift;
my $from = shift // time;

my $s = $from - $self->epoch;
my $s = (shift // time) - $self->epoch;
$s = $s * -1 if my $in = $s < 0;
return _wrap($in, 'less than a minute') if $s < 45;
return _wrap($in, 'about a minute') if $s < 90;
Expand Down Expand Up @@ -204,7 +203,7 @@ Render date suitable for HTTP messages.
my $str = $date->to_words;
my $str = $date->to_words(784111777);
Distance of time in words from now or a specific point in time.
Report the approximate distance of time from now or a specific point in time.
# "less than a minute ago"
Mojo::Date->new(time - 1)->to_words;
Expand Down

0 comments on commit 0914bba

Please sign in to comment.