* cal -w and ISO weeks
@ 2019-12-30 13:09 Leah Neukirchen
2020-01-03 11:19 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Leah Neukirchen @ 2019-12-30 13:09 UTC (permalink / raw)
To: util-linux
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/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: cal -w and ISO weeks
2019-12-30 13:09 cal -w and ISO weeks Leah Neukirchen
@ 2020-01-03 11:19 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2020-01-03 11:19 UTC (permalink / raw)
To: Leah Neukirchen; +Cc: util-linux, J William Piggott
On Mon, Dec 30, 2019 at 02:09:16PM +0100, Leah Neukirchen wrote:
> So, to avoid further confusion, I'd propose to:
>
> 1) Reword the description of -w in the man page cal(1).
Fixed (we already have a note about it in NOTES section, but it's
somehow pretty hidden at the first glance).
https://github.com/karelzak/util-linux/commit/261cf856277f5e7e4815c211fe48b97746d5d3a3
> 2) Rethink if --iso shouldn't also imply -m, as implied by ISO-8601.
Good point, sounds like user-friendly change (although it is not 100%
backwardly compatible).
William, what about to automatically use -m (start week at Monday)
when --iso specified on command line? It means not keep --iso only
as way to switch calendars, but also as a general option to get
ISO-8601. (Not sure, may be we already discussed this years ago.)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-03 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 13:09 cal -w and ISO weeks Leah Neukirchen
2020-01-03 11:19 ` Karel Zak
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.