Skip to content

Fix Calendar.strftime/3 width calculations - #15665

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-calendar_strftime_widths-fix
Jul 24, 2026
Merged

Fix Calendar.strftime/3 width calculations#15665
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-calendar_strftime_widths-fix

Conversation

@AlexGx

@AlexGx AlexGx commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Preferred formats measured by their iodata element count instead of rendered length

iex> Calendar.strftime(~N[2019-08-15 17:07:57], "%20c")
"0000000002019-08-15 17:07:57" # expected: "02019-08-15 17:07:57"

Unicode values measured in bytes, must in graphemes

iex> Calendar.strftime(%{month: 9}, "%10B", month_names: fn _ -> "вересень" end)
"вересень" # expected: "  вересень"

@josevalim
josevalim merged commit ffcea82 into elixir-lang:main Jul 24, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@AlexGx
AlexGx deleted the ag-calendar_strftime_widths-fix branch July 30, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants