All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leah Neukirchen <leah@vuxu.org>
To: util-linux@vger.kernel.org
Subject: cal -w and ISO weeks
Date: Mon, 30 Dec 2019 14:09:16 +0100	[thread overview]
Message-ID: <87fth2ark3.fsf@vuxu.org> (raw)

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@vuxu.org>  https://leahneukirchen.org/

             reply	other threads:[~2019-12-30 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30 13:09 Leah Neukirchen [this message]
2020-01-03 11:19 ` cal -w and ISO weeks Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fth2ark3.fsf@vuxu.org \
    --to=leah@vuxu.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.