We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::fmt::Display
Weekday
The Display implementation of Weekday uses Formatter::write_str, which doesn't honour width or alignment and fill.
Display
Formatter::write_str
use chrono::Weekday; fn main() { println!("Expected result: <{:X>10}>", format!("{}", Weekday::Mon)); println!("Actual result: <{:X>10}>", Weekday::Mon); }
(Playground)
<XXXXXXXMon>
<Mon>
The text was updated successfully, but these errors were encountered:
Looking further, seems like the easy way out is to use Formatter::pad instead of write_str.
Formatter::pad
write_str
Sorry, something went wrong.
Happy to review a PR for this!
Use Formatter::pad (instead of write_str) for Weekdays
5fbd077
That way, width, alignment and fill from the format string are respected. Fixes chronotope#1620.
There you go: #1621
771c047
Successfully merging a pull request may close this issue.
Summary
The
Display
implementation ofWeekday
usesFormatter::write_str
, which doesn't honour width or alignment and fill.Reproducer
(Playground)
Expected result
<XXXXXXXMon>
Actual result
<Mon>
The text was updated successfully, but these errors were encountered: