summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-31 15:09:28 +0200
committerYorhel <git@yorhel.nl>2009-05-31 15:09:28 +0200
commit776743c0b8f1adb6f6335b7c1bb30323879cf98c (patch)
tree4f5f0edfc906ba5d5c9ba7a1351908ae6ae105fa /lib
parent64fc83df49a9538a7d4f445fd6b3fa932080add3 (diff)
Func::monthstr: Output date in italics if the day is unknown
<RT> yorhel, in the browse view, can you put the date in italics when the first complete release date is not "fully qualified" ? e.g. 2008-08
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Func.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index 0a5a9038..e64527ef 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -66,11 +66,12 @@ sub datestr {
# e.g.: 'Jan 2009', '2009', 'unknown', 'TBA'
sub monthstr {
my $date = sprintf '%08d', shift||0;
- my($y, $m) = ($1, $2) if $date =~ /^([0-9]{4})([0-9]{2})/;
+ my($y, $m, $d) = ($1, $2, $3) if $date =~ /^([0-9]{4})([0-9]{2})([0-9]{2})/;
return 'TBA' if $y == 9999;
return 'unknown' if $y == 0;
return $y if $m == 99;
- return sprintf '%s %d', [qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)]->[$m-1], $y;
+ my $r = sprintf '%s %d', [qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)]->[$m-1], $y;
+ return $d == 99 ? "<i>$r</i>" : $r;
}