bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stephen Berman
Subject: bug#78096: 31.0.50; calendar-iso-to-absolute and %W time string format are inconsistent
Date: Sun, 27 Apr 2025 23:05:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Sun, 27 Apr 2025 15:28:43 +0000 Ihor Radchenko <yantar92@posteo.net> wrote:

> Hi,
>
> This bug was originally reported in
> https://orgmode.org/list/174544167676.8.6104466990232889732.690779499@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]