From 71a7ba52e5c6d9ba2d87074810f033fc07bf7f4a Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 29 Dec 2015 17:57:14 +1000 Subject: [PATCH] + LDV::Helpers->from_unixtime --- lib/LDV/Helpers.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/LDV/Helpers.pm b/lib/LDV/Helpers.pm index 3caa677..acf224b 100644 --- a/lib/LDV/Helpers.pm +++ b/lib/LDV/Helpers.pm @@ -6,6 +6,7 @@ use utf8; use Mojo::Base 'Mojolicious::Plugin'; +use POSIX qw(strftime); use Text::Markdown; sub register { @@ -22,6 +23,11 @@ sub register { $text =~ s{\r?\n}{
}go; return $text; }); + + $app->helper(from_unixtime => sub { + my ($c, $unixtime) = @_; + return strftime("%Y-%m-%d %H:%M", localtime($unixtime)); + }); } 1;