diff --git a/lib/App/txtnix.pm b/lib/App/txtnix.pm index f553c1a..9b79925 100644 --- a/lib/App/txtnix.pm +++ b/lib/App/txtnix.pm @@ -52,7 +52,7 @@ has registry => sub { "https://roster.twtxt.org" }; has [ qw( colors twturl pre_tweet_hook post_tweet_hook config_file - force key_file cert_file plugins cache ) + force key_file cert_file plugins cache) ]; sub new { @@ -432,6 +432,8 @@ sub parse_twtfile { substr( $tweet->text, 0, $self->character_limit ) ); } + $tweet->formatted_time( $tweet->strftime( $self->time_format ) ); + push @tweets, $tweet; } } @@ -559,10 +561,10 @@ __DATA__ % my $text = $tweet->text; % $text =~ s/(@\w+)/colored($1, $app->colors->{mention})/ge; % $text =~ s/(#\w+)/colored($1, $app->colors->{hashtag})/ge; -% my $time = $tweet->strftime( $app->time_format ); +% my $time = colored($tweet->formatted_time,$app->colors->{time}); % my $nick = colored($tweet->nick, $app->colors->{nick}); % -* <%= $nick %> (<%= colored($time, $app->colors->{time}) %>): +* <%= $nick %> (<%= $time %>): % if ( $app->wrap_text ) { %= wrap('','',$text) . "\n" % } else { diff --git a/lib/App/txtnix/Tweet.pm b/lib/App/txtnix/Tweet.pm index 48ffc58..faff9aa 100644 --- a/lib/App/txtnix/Tweet.pm +++ b/lib/App/txtnix/Tweet.pm @@ -9,8 +9,9 @@ use POSIX (); has [qw(source text)]; has timestamp => sub { Mojo::Date->new() }; -has is_metadata => sub { !!@{ shift->command } }; -has command => sub { [] }; +has is_metadata => sub { !!@{ shift->command } }; +has command => sub { [] }; +has formatted_time => sub { shift->strftime('%Y-%m-%d %H:%M') }; sub nick { shift->source->to_string;