Package: ncal
Version: 12.1.7+nmu3
Severity: normal

Dear Maintainer,

ncal lists incorrect week numbers when using the -w option.

Week numbers do not conform in the ISO-8601 standard, even though the
man page states that the "-w" option is ISO-8601 compliant.

For example, when producing a calendar for today (2021-09-24):

  $ ncal -w

ncal outputs the following:

        September 2021    
  Su     5 12 19 26   
  Mo     6 13 20 27   
  Tu     7 14 21 28   
  We  1  8 15 22 29   
  Th  2  9 16 23 30   
  Fr  3 10 17 24      
  Sa  4 11 18 25      
     36 37 38 39 40

Which incorrectly lists today's week number as "39" when the correct
ISO-8601 week number for 2021-09-24 is W38.

The correct week number can be verified using the date command:

  $ date -d "2021-09-24" +%W
  38

This seems to be caused by ncal miscounting the first week for the year:

  $ ncal -b -w 2021
                                       2021
           January                   February                     March
   w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa
   1|                 1  2    6|     1  2  3  4  5  6   10|     1  2  3  4  5  6
   2|  3  4  5  6  7  8  9    7|  7  8  9 10 11 12 13   11|  7  8  9 10 11 12 13
   3| 10 11 12 13 14 15 16    8| 14 15 16 17 18 19 20   12| 14 15 16 17 18 19 20
   4| 17 18 19 20 21 22 23    9| 21 22 23 24 25 26 27   13| 21 22 23 24 25 26 27
   5| 24 25 26 27 28 29 30   10| 28                     14| 28 29 30 31
   6| 31
  
            April                       May                       June
   w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa
  14|              1  2  3   18|                    1   23|        1  2  3  4  5
  15|  4  5  6  7  8  9 10   19|  2  3  4  5  6  7  8   24|  6  7  8  9 10 11 12
  16| 11 12 13 14 15 16 17   20|  9 10 11 12 13 14 15   25| 13 14 15 16 17 18 19
  17| 18 19 20 21 22 23 24   21| 16 17 18 19 20 21 22   26| 20 21 22 23 24 25 26
  18| 25 26 27 28 29 30      22| 23 24 25 26 27 28 29   27| 27 28 29 30
                             23| 30 31
  
            July                      August                    September
   w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa
  27|              1  2  3   32|  1  2  3  4  5  6  7   36|           1  2  3  4
  28|  4  5  6  7  8  9 10   33|  8  9 10 11 12 13 14   37|  5  6  7  8  9 10 11
  29| 11 12 13 14 15 16 17   34| 15 16 17 18 19 20 21   38| 12 13 14 15 16 17 18
  30| 18 19 20 21 22 23 24   35| 22 23 24 25 26 27 28   39| 19 20 21 22 23 24 25
  31| 25 26 27 28 29 30 31   36| 29 30 31               40| 26 27 28 29 30
  
  
           October                   November                   December
   w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa    w| Su Mo Tu We Th Fr Sa
  40|                 1  2   45|     1  2  3  4  5  6   49|           1  2  3  4
  41|  3  4  5  6  7  8  9   46|  7  8  9 10 11 12 13   50|  5  6  7  8  9 10 11
  42| 10 11 12 13 14 15 16   47| 14 15 16 17 18 19 20   51| 12 13 14 15 16 17 18
  43| 17 18 19 20 21 22 23   48| 21 22 23 24 25 26 27   52| 19 20 21 22 23 24 25
  44| 24 25 26 27 28 29 30   49| 28 29 30                1| 26 27 28 29 30 31
  45| 31

The first week in January 2021 is incorrectly indicated as week "1".
According to ISO-8601 the first week of the year is the week that
contains that year's first Thursday.  As such, the first week in January
2021 should be "0" and the week with the first Thursday should be "1".

Thank you,

Andrew

-- System Information:
Debian Release: 11.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/24 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ncal depends on:
ii  libc6      2.31-13
ii  libtinfo6  6.2+20201114-2

ncal recommends no packages.

ncal suggests no packages.

-- no debconf information

Reply via email to