From: "andrykonchin (Andrew Konchin)" Date: 2022-11-15T15:43:23+00:00 Subject: [ruby-core:110769] [Ruby master Misc#19098] Time#strftime: %z and width Issue #19098 has been updated by andrykonchin (Andrew Konchin). I have checked on MacOS Monterey and Debian 11 (bullseye) (in Docker, if it matters) and received the same results like mentioned in the description. ---------------------------------------- Misc #19098: Time#strftime: %z and width https://bugs.ruby-lang.org/issues/19098#change-100112 * Author: andrykonchin (Andrew Konchin) * Status: Open * Priority: Normal ---------------------------------------- It seems `%z` behaves in some surprising way when it is combined with a width - sign `+` is placed at the beginning of the result string: ```ruby Time.now.strftime("%10z") => "+000000200" Time.now.strftime("%_10z") => " +200" ``` It seems a time zone offset is treated as a number. It probably makes sense with default format but it looks strange with `:` separators: ```ruby Time.now.strftime("%10::z") # => "+002:00:00" ``` So I would expect that `%z` directive output to be treated as a non-numerical and padded by default with spaces. -- https://bugs.ruby-lang.org/ Unsubscribe: