Closed horazont closed 1 month ago
The Display implementation of Weekday uses Formatter::write_str, which doesn't honour width or alignment and fill.
Display
Weekday
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>
Looking further, seems like the easy way out is to use Formatter::pad instead of write_str.
Formatter::pad
write_str
Happy to review a PR for this!
There you go: https://github.com/chronotope/chrono/pull/1621
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>