Conversation
|
GNU testsuite comparison: |
| @@ -0,0 +1,25 @@ | |||
| mod timezone_date { | |||
There was a problem hiding this comment.
please add the license header
| /// Get the alphabetic abbreviation of the current timezone. | ||
| /// | ||
| /// For example, "UTC" or "CET" or "PDT". | ||
| fn timezone_abbrev() -> &str { |
There was a problem hiding this comment.
please write unit test in this file :)
| offset.abbreviation().unwrap_or("UTC").to_string() | ||
| } | ||
|
|
||
| /// Format the given time according to a custom format string. |
There was a problem hiding this comment.
please document a bit more the arguments as rustdoc
Yes, that's the right place.
You have to wire it up in Hope that helps. |
|
Thanks for the feedbacks! |
|
GNU testsuite comparison: |
src/uucore/Cargo.toml
Outdated
|
|
||
| [dependencies] | ||
| chrono = { workspace = true } | ||
| chrono-tz = {workspace = true} |
There was a problem hiding this comment.
A detail that should make the Style/toml job in the CI pass:
| chrono-tz = {workspace = true} | |
| chrono-tz = { workspace = true } |
src/uu/ls/src/ls.rs
Outdated
| (Self::Locale, false) => time.format("%b %e %Y").to_string(), | ||
| (Self::Format(e), _) => custom_time_format(e, time), | ||
| (Self::Format(fmt), _) => { | ||
| // this line can be replaced with the one in timzone_date.rs |
There was a problem hiding this comment.
I guess this comment is no longer needed?
| // this line can be replaced with the one in timzone_date.rs |
src/uu/date/src/date.rs
Outdated
| let format_string = &format_string | ||
| .replace("%N", "%f") | ||
| .replace("%Z", tz_abbreviation.unwrap_or("UTC")); | ||
| let format_string = custom_time_format(&format_string); |
There was a problem hiding this comment.
clippy complains about this line:
| let format_string = custom_time_format(&format_string); | |
| let format_string = custom_time_format(format_string); |
|
GNU testsuite comparison: |
|
Thanks! |
* refactoring ls and date * Refactored and integrated ls and date and added tests to the new feature * Style refactoring
This PR tries to refactor the common datetime formatting code in
lsanddateas requested in the issue #7156.I have created a new file under
uucore/lib/features, but I am not sure if it is the right place. Moreover, I tried to import the module but without success, so I left theCargo.tomlof each crate as it was.Is it correct? How can I import the new module created?