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

Bug in date->string



Hi,

I think I found a bug in date->string. The ~Y pattern doesn't correctly pad years up to 4 digits:

  (date->string (string->date "01/02/0003" "~d/~m/~Y") "~d/~m/~Y")
  ; ==> "01/02/03" instead of "01/02/0003"

I fixed the problem by changing the #\Y component in the definition of tm:directives to:

  (cons #\Y (lambda (date pad-with port)
              (display (tm:padding (date-year date)
                                   pad-with
                                   4)
                       port)))

The original code was:

  (cons #\Y (lambda (date pad-with port)
              (display (date-year date) port))))

Many thanks,

-- Dave