bug-gcal
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong ISO week determination for Oct 2022


From: Jan Engelhardt
Subject: Wrong ISO week determination for Oct 2022
Date: Fri, 23 Sep 2022 10:35:13 +0200 (CEST)
User-agent: Alpine 2.25 (LSU 592 2021-09-18)

Greetings.


Observe with gcal-4.1, that --iso-week-number=yes in combination
with --starting-day != Monday produces uncanny CW values.
The default for --starting-day is Sunday.

$ gcal --iso-week-number=yes -K jan 2022

     January 2022
 Su Mo Tu We Th Fr Sa CW
                    1 52/0
  2  3  4  5  6  7  8 52/0
  9 10 11 12 13 14 15 01
 16 17 18 19 20 21 22 02
 23 24 25 26 27 28 29 03
 30 31                04

I would have naturally expected the CW field to show "01", but I get it:
January 02 belongs to week 0 in all cases, and the CW field is fed from
that. Oh well.

Option one: Warn about this case.

10:34 a4:../gcal/gcal-4.1 $ quilt diff
Index: gcal-4.1/src/gcal.c
===================================================================
--- gcal-4.1.orig/src/gcal.c
+++ gcal-4.1/src/gcal.c
@@ -5982,6 +5982,10 @@ check_command_line (argc, argv)
            break;
        }
     }
+  if (iso_week_number && start_day != 1)
+    {
+      fprintf (stderr, _("NOTE: Combining --iso-week-number=yes with 
--starting-day=%u can lead to unexpected values for CW, because the CW field is 
populated from the starting day, not Monday.\n"));
+    }
 #if USE_RC
   /*
      Read the internal system date an evaluate


Or, option two: Specify all weeks that apply for that row:

$ gcal --iso-week-number=yes -K -s Fr jan 2022

 Fr Sa Su Mo Tu We Th CW
     1  2  3  4  5  6 52/0,01
  7  8  9 10 11 12 13 01-02
 14 15 16 17 18 19 20 02,03
 21 22 23 24 25 26 27 03,04
 28 29 30 31          04,05



reply via email to

[Prev in Thread] Current Thread [Next in Thread]