Remove month and year duration constants (#6613)

remove month/year/decade durations for parsing and units, but leave the humanized output for viewing
This commit is contained in:
JT
2022-09-26 09:55:13 +13:00
committed by GitHub
parent 43905caa46
commit d66a5398d1
6 changed files with 2 additions and 82 deletions

View File

@ -1570,41 +1570,5 @@ fn compute(size: i64, unit: Unit, span: Span) -> Value {
),
},
},
Unit::Month => match size.checked_mul(1000 * 1000 * 1000 * 60 * 60 * 24 * 30) {
Some(val) => Value::Duration { val, span },
None => Value::Error {
error: ShellError::GenericError(
"month duration too large".into(),
"month duration too large".into(),
Some(span),
None,
Vec::new(),
),
},
},
Unit::Year => match size.checked_mul(1000 * 1000 * 1000 * 60 * 60 * 24 * 365) {
Some(val) => Value::Duration { val, span },
None => Value::Error {
error: ShellError::GenericError(
"year duration too large".into(),
"year duration too large".into(),
Some(span),
None,
Vec::new(),
),
},
},
Unit::Decade => match size.checked_mul(1000 * 1000 * 1000 * 60 * 60 * 24 * 365 * 10) {
Some(val) => Value::Duration { val, span },
None => Value::Error {
error: ShellError::GenericError(
"decade duration too large".into(),
"decade duration too large".into(),
Some(span),
None,
Vec::new(),
),
},
},
}
}