GNU bug report logs - #78096
31.0.50; calendar-iso-to-absolute and %W time string format are inconsistent

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sun, 27 Apr 2025 15:30:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 78096-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: yantar92 <at> posteo.net, stephen.berman <at> gmx.net, 78096-done <at> debbugs.gnu.org
Subject: Re: bug#78096: 31.0.50;
 calendar-iso-to-absolute and %W time string format are inconsistent
Date: Sat, 10 May 2025 12:52:14 +0300
> Cc: Stephen Berman <stephen.berman <at> gmx.net>, 78096 <at> debbugs.gnu.org
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Date: Mon, 28 Apr 2025 18:43:18 +0200
> 
> On Apr 28 2025, Ihor Radchenko wrote:
> 
> > Stephen Berman <stephen.berman <at> gmx.net> writes:
> >
> >> The doc string of `format-time-string' says:
> >>
> >> %U is the week number starting on Sunday, %W starting on Monday,
> >>  %V the week number according to ISO 8601.
> >>
> >> (format-time-string
> >>   "%Y-%m-%d W%V"
> >>   (encode-time (parse-time-string "2025-01-06 00:00")))
> >> => "2025-01-06 W02"
> >
> > That indeed explains it - %W and %V are apparently not the same and
> > `calendar-iso-to-absolute' is closer to %V.
> 
> The difference is that %V is always the same for the whole week, whereas
> %V and %W roll over on 01-01 (and use 0 for a partial first week).
> 
> $ for y in $(seq 2020 2025); do date -d "$y-01-01" +"%a %U %V %W"; done
> Wed 00 01 00
> Fri 00 53 00
> Sat 00 52 00
> Sun 01 52 00
> Mon 00 01 01
> Wed 00 01 00

AFAIU, this bug report was based on a misunderstanding of the
subtleties of time formats.  I've updated the documentation to
clarify the differences between these formats, and I'm therefore
closing this bug.




This bug report was last modified 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.