]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/calendar.pm
year calendar: Avoid highlighting the current month in a different year
[ikiwiki.git] / IkiWiki / Plugin / calendar.pm
index ddcd1a82350d0058a1c22e4abd99297adb059773..c9bdf4a17b3dc36a5804fcd41f3e8a609be30548 100644 (file)
@@ -262,8 +262,9 @@ sub format_year (@) {
        my $pyear = $params{year}  - 1;
        my $nyear = $params{year}  + 1;
 
+       my $thisyear = $now[5]+1900;
        my $future_month = 0;
-       $future_month = $now[4]+1 if ($params{year} == $now[5]+1900);
+       $future_month = $now[4]+1 if $params{year} == $thisyear;
 
        my $archivebase = 'archives';
        $archivebase = $config{archivebase} if defined $config{archivebase};
@@ -314,7 +315,7 @@ EOF
                $calendar.=qq{\t<tr>\n}  if ($month % $params{months_per_row} == 1);
                my $tag;
                my $mtag=sprintf("%02d", $month);
-               if ($month == $params{month}) {
+               if ($month == $params{month} && $thisyear == $params{year}) {
                        $tag = 'year-calendar-this-month';
                }
                elsif ($pagesources{"$archivebase/$params{year}/$mtag"}) {