Skip to content

Fix width and alignment for calendar types - #4935

Open
IfkumRfnl wants to merge 1 commit into
fmtlib:mainfrom
IfkumRfnl:investigate/calendar-padding
Open

Fix width and alignment for calendar types#4935
IfkumRfnl wants to merge 1 commit into
fmtlib:mainfrom
IfkumRfnl:investigate/calendar-padding

Conversation

@IfkumRfnl

Copy link
Copy Markdown
Contributor

Summary

Calendar formatters used a full timestamp when the format specified only width or alignment. For example, fmt::format("{:5}", fmt::day(5)) returned 1900-01-05 00:00:00. Formatting a year with width caused an assertion failure.

Set the default format for each calendar type before parsing. This keeps the calendar output when width or alignment is specified.

Added regression tests for all five calendar types, including fill, dynamic width, explicit chrono formats, and localization. The C++17 chrono and wide-character test suites pass.

@IfkumRfnl
IfkumRfnl marked this pull request as ready for review September 7, 2026 06:54
@IfkumRfnl
IfkumRfnl requested a review from vitaut as a code owner September 7, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant