GNU bug report logs -
#78096
31.0.50; calendar-iso-to-absolute and %W time string format are inconsistent
Previous Next
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 #8 received at 78096 <at> debbugs.gnu.org (full text, mbox):
On Sun, 27 Apr 2025 15:28:43 +0000 Ihor Radchenko <yantar92 <at> posteo.net> wrote:
> Hi,
>
> This bug was originally reported in
> https://orgmode.org/list/174544167676.8.6104466990232889732.690779499 <at> publik.slmail.me
>
> Consider the following:
>
> (calendar-gregorian-from-absolute
> ;; First day of the second week of 2025
> (calendar-iso-to-absolute (list 2 1 2025))) ; => 2025-01-06
>
> Now, let's try to format the same date using `format-time-string'
>
> (format-time-string
> "%Y-%m-%d W%W"
> (encode-time (parse-time-string "2025-01-06 00:00")))
> ;; => 2025-01-06 W01
>
> As you can see, week numbering is off by 1 between %W and
> `calendar-iso-to-absolute', which is unexpected.
>
> I believe that it is a bug.
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"
Maybe just starting the week on Monday does not guarantee that the
result is an ISO commercial date?
Steve Berman
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.