diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-28 18:02:52 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-28 18:02:52 +0100 |
commit | 3773cf3459d023ed3515afbd4ff7b3e1253dc4d0 (patch) | |
tree | ab4d4f6e1b99b93f9b916b64a99aa198e2ece20b /perllib/Utils.pm | |
parent | e2414d30dd673ecea38e2a40d187b835bd076ac3 (diff) | |
parent | 70cbebec7bb2fd412c6a9fbfb694357401916372 (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts:
perllib/FixMyStreet/App/Controller/Report/Update.pm
templates/web/default/report/display.html
Diffstat (limited to 'perllib/Utils.pm')
-rw-r--r-- | perllib/Utils.pm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 44234607f..39c251876 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -210,20 +210,25 @@ sub cleanup_text { } sub prettify_epoch { - my ($s, $short) = @_; + my ( $s, $type ) = @_; + $type = 'short' if $type eq '1'; + my @s = localtime($s); - my $tt = strftime('%H:%M', @s); + my $tt = ''; + $tt = strftime('%H:%M', @s) unless $type eq 'date'; my @t = localtime(); if (strftime('%Y%m%d', @s) eq strftime('%Y%m%d', @t)) { - $tt = "$tt " . _('today'); - } elsif (strftime('%Y %U', @s) eq strftime('%Y %U', @t)) { - $tt = "$tt, " . decode_utf8(strftime('%A', @s)); - } elsif ($short) { - $tt = "$tt, " . decode_utf8(strftime('%e %b %Y', @s)); + return "$tt " . _('today'); + } + $tt .= ', ' unless $type eq 'date'; + if (strftime('%Y %U', @s) eq strftime('%Y %U', @t)) { + $tt .= decode_utf8(strftime('%A', @s)); + } elsif ($type eq 'short') { + $tt .= decode_utf8(strftime('%e %b %Y', @s)); } elsif (strftime('%Y', @s) eq strftime('%Y', @t)) { - $tt = "$tt, " . decode_utf8(strftime('%A %e %B %Y', @s)); + $tt .= decode_utf8(strftime('%A %e %B %Y', @s)); } else { - $tt = "$tt, " . decode_utf8(strftime('%a %e %B %Y', @s)); + $tt .= decode_utf8(strftime('%a %e %B %Y', @s)); } return $tt; } |