Allow int input when using a formatstring
This commit is contained in:
parent
07e7c8c81f
commit
2ad05d3dd6
|
@ -379,8 +379,8 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
|
|||
|
||||
// If input is not a timestamp, try parsing it as a string
|
||||
let span = input.span();
|
||||
match input {
|
||||
Value::String { val, .. } => {
|
||||
|
||||
let parse_as_string = |val: &str| {
|
||||
match dateformat {
|
||||
Some(dt) => match DateTime::parse_from_str(val, &dt.0) {
|
||||
Ok(d) => Value::date ( d, head ),
|
||||
|
@ -414,7 +414,12 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
|
|||
Err(err) => err,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
match input {
|
||||
Value::String { val, .. } => parse_as_string(val),
|
||||
Value::Int { val, .. } => parse_as_string(&val.to_string()),
|
||||
|
||||
// Propagate errors by explicitly matching them before the final case.
|
||||
Value::Error { .. } => input.clone(),
|
||||
other => Value::error(
|
||||
|
|
Loading…
Reference in New Issue
Block a user