On Sun, 23 Dec 2012 06:52:15 +0100, gregor herrmann wrote:

> But ignoring that, it links to each posting I ever made in a
> December, not only in 2012. Which is not surprising since the code
> only checks for the month ...

And in months with single digits (or it least in January) it doesn't
work, since 01 eq 1 is not true.

The following seems to work:

#v+
--- unpacked/usr/bin/chronicle  2011-05-15 20:15:12.000000000 +0200
+++ /usr/bin/chronicle  2013-01-06 19:29:25.177514918 +0100
@@ -3177,7 +3172,9 @@
     $cal->weekdays( 'Mo', 'Tue', 'We', 'Thu', 'Fr' );
 
     # get 4th element from localtime aka month in form of (0..11)
-    my $curmonth = (localtime)[4] + 1;
+    my $curmonth = sprintf( "%02d", (localtime)[4] + 1 );
+    # get 5th element from localtime aka year in form of year-since-1900
+    my $curyear = (localtime)[5] + 1900;
 
     foreach my $f (%data)
     {
@@ -3199,7 +3196,7 @@
         my ( $year, $month, $day ) = split( /-/, $date );
 
 
-        if ( $month eq $curmonth )
+        if ( $month eq $curmonth && $year eq $curyear )
         {
             $cal->setdatehref( $day, fileToTitle( $data{ $f }->{ 'title' } ) );
         }
#v-


Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Walter Tessaris: Big Buck

Attachment: signature.asc
Description: Digital signature

Reply via email to