cal -w and ISO weeks

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

 



Hi,

fiddling around with 'cal -w' made me stumble in 2021:

% cal -w 1 2021 
      January 2021     
   Su Mo Tu We Th Fr Sa
 1                 1  2
 2  3  4  5  6  7  8  9
 3 10 11 12 13 14 15 16
 4 17 18 19 20 21 22 23
 5 24 25 26 27 28 29 30
 6 31                  

Obviously these week numbers are not ISO weeks.  The manpage says:

       -w, --week[=number]
              Display week numbers in the calendar (US or ISO-8601).

So the next thing I tried was:

% cal --iso -w 1 2021  
      January 2021     
   Su Mo Tu We Th Fr Sa
 1                 1  2
 2  3  4  5  6  7  8  9
 3 10 11 12 13 14 15 16
 4 17 18 19 20 21 22 23
 5 24 25 26 27 28 29 30
 6 31                  

I actually had to read the OpenBSD man pages to see what's
going on:

     -w      Display week numbers in the month display.  If -m is specified
             the ISO week format is assumed.  The options -j and -w are
             mutually exclusive.

Finally:

% cal -m -w 1 2021      
      January 2021     
   Mo Tu We Th Fr Sa Su
53              1  2  3
 1  4  5  6  7  8  9 10
 2 11 12 13 14 15 16 17
 3 18 19 20 21 22 23 24
 4 25 26 27 28 29 30 31
                       
So, to avoid further confusion, I'd propose to:

1) Reword the description of -w in the man page cal(1).

2) Rethink if --iso shouldn't also imply -m, as implied by ISO-8601.

Thanks,
-- 
Leah Neukirchen  <leah@xxxxxxxx>  https://leahneukirchen.org/



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux