Subject: bug#78096: 31.0.50; calendar-iso-to-absolute and %W time string format are inconsistent

From: Ihor Radchenko <[email-masked]>
Date: Sun, 27 Apr 2025 15:28:43 +0000

Hi,

This bug was originally reported in
https://orgmode.org/list/[email-masked]

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.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.42, cairo version 1.18.2) of 2025-04-22 built on localhost
Repository revision: a9ace435a341918eae3e01f2941f5bbca04d7795
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Gentoo Linux

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>