You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
Merge pull request #216 from cakebaker/refactor_rename_var_to_fix_typo
refactor: rename var to fix typo
This commit is contained in:
@@ -106,16 +106,16 @@ fn seconds(input: &mut &str) -> ModalResult<Relative> {
|
||||
fn displacement(input: &mut &str) -> ModalResult<Relative> {
|
||||
(opt(ordinal), s(alpha1), ago)
|
||||
.verify_map(|(n, unit, ago): (Option<i32>, &str, bool)| {
|
||||
let multipler = n.unwrap_or(1) * if ago { -1 } else { 1 };
|
||||
let multiplier = n.unwrap_or(1) * if ago { -1 } else { 1 };
|
||||
Some(match unit.strip_suffix('s').unwrap_or(unit) {
|
||||
"year" => Relative::Years(multipler),
|
||||
"month" => Relative::Months(multipler),
|
||||
"fortnight" => Relative::Days(multipler.checked_mul(14)?),
|
||||
"week" => Relative::Days(multipler.checked_mul(7)?),
|
||||
"day" => Relative::Days(multipler),
|
||||
"hour" => Relative::Hours(multipler),
|
||||
"minute" | "min" => Relative::Minutes(multipler),
|
||||
"second" | "sec" => Relative::Seconds(multipler as i64, 0),
|
||||
"year" => Relative::Years(multiplier),
|
||||
"month" => Relative::Months(multiplier),
|
||||
"fortnight" => Relative::Days(multiplier.checked_mul(14)?),
|
||||
"week" => Relative::Days(multiplier.checked_mul(7)?),
|
||||
"day" => Relative::Days(multiplier),
|
||||
"hour" => Relative::Hours(multiplier),
|
||||
"minute" | "min" => Relative::Minutes(multiplier),
|
||||
"second" | "sec" => Relative::Seconds(multiplier as i64, 0),
|
||||
_ => return None,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user