Renamed time units (#2356)

* Changed time units as outlined in issue #2353.
Also applied changes to to_str for Unit - not sure if that was what was wanted.

* Forgot the tests!

* Updated primitive.rs to match changes.

* Updated where example to match changes.

* And the html test!
This commit is contained in:
Matt Clarke
2020-08-15 21:03:28 +02:00
committed by GitHub
parent c6588c661a
commit c59f860b48
6 changed files with 26 additions and 26 deletions

View File

@ -465,13 +465,13 @@ impl Unit {
Unit::Nanosecond => "ns",
Unit::Microsecond => "us",
Unit::Millisecond => "ms",
Unit::Second => "s",
Unit::Minute => "m",
Unit::Hour => "h",
Unit::Day => "d",
Unit::Week => "w",
Unit::Month => "M",
Unit::Year => "y",
Unit::Second => "sec",
Unit::Minute => "min",
Unit::Hour => "hr",
Unit::Day => "day",
Unit::Week => "wk",
Unit::Month => "mon",
Unit::Year => "yr",
}
}

View File

@ -302,19 +302,19 @@ pub fn format_duration(duration: &BigInt) -> String {
let mut output_prep = vec![];
if !days.is_zero() {
output_prep.push(format!("{}d", days));
output_prep.push(format!("{}day", days));
}
if !hours.is_zero() {
output_prep.push(format!("{}h", hours));
output_prep.push(format!("{}hr", hours));
}
if !mins.is_zero() {
output_prep.push(format!("{}m", mins));
output_prep.push(format!("{}min", mins));
}
if !secs.is_zero() {
output_prep.push(format!("{}s", secs));
output_prep.push(format!("{}sec", secs));
}
if !millis.is_zero() {