diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index e39d660e39..a1ff6fffb5 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -85,6 +85,11 @@ impl Command for SubCommand { span: Span::test_data(), }), }, + Example { + description: "Convert date to integer (Unix timestamp)", + example: "2022-02-02 | into int", + result: Some(Value::test_int(1643760000)), + }, Example { description: "Convert to integer from binary", example: "'1101' | into int -r 2", @@ -181,6 +186,10 @@ pub fn action(input: &Value, span: Span, radix: u32) -> Value { Value::Int { val: 0, span } } } + Value::Date { val, .. } => Value::Int { + val: val.timestamp(), + span, + }, _ => Value::Error { error: ShellError::UnsupportedInput("'into int' for unsupported type".into(), span), },