You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
fix: use checked_mul() to avoid overflow panic
This commit is contained in:
@@ -110,7 +110,7 @@ fn displacement(input: &mut &str) -> ModalResult<Relative> {
|
||||
Some(match unit.strip_suffix('s').unwrap_or(unit) {
|
||||
"year" => Relative::Years(multipler),
|
||||
"month" => Relative::Months(multipler),
|
||||
"fortnight" => Relative::Days(14 * multipler),
|
||||
"fortnight" => Relative::Days(multipler.checked_mul(14)?),
|
||||
"week" => Relative::Days(7 * multipler),
|
||||
"day" => Relative::Days(multipler),
|
||||
"hour" => Relative::Hours(multipler),
|
||||
|
||||
Reference in New Issue
Block a user