Subject: bug#74841: [PATCH] srfi-19: Fix ~V converter in date->string.

From: Ludovic Courtès <[email-masked]>
Date: Sun, 22 Dec 2024 22:41:41 +0100

Hi,

Tomas Volf <[email-masked]> skribis:

> The ~V is supposed to print ISO week number, not a week number.  This
> commit fixes that.
>
> * module/srfi/srfi-19.scm (date-week-number-iso): New procedure taken
> from the reference implementation.
> (directives)<#\V>: Use it.
> * test-suite/tests/srfi-19.test ("date->string ~V"): Add tests taken
> from the reference test suite.

The manual just reads this:

     ~U     week of year, Sunday first day of week, ‘00’ to
            ‘52’
     ~V     week of year, Monday first day of week, ‘01’ to
            ‘53’

Should it be fixed or clarified?

> +(define (date-week-number-iso date)

Please add a docstring.

> +  (let ((convert (λ (lst)
> +                   (date->string
> +                    (make-date 0 0 0 0
> +                               (caddr lst) (cadr lst) (car lst)

Please use ‘match-lambda’.

> +    (with-test-prefix "date->string ~V"
> +      (pass-if-equal "Thursday, week 53" "53"

If these are from the SRFI-19 spec, could you add a comment to say so?

Thanks,
Ludo’.