diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index d5dc6264ea..42169cd874 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -84,6 +84,10 @@ pub fn is_math_expression_like( return true; } + if parse_datetime(working_set, span).1.is_none() { + return true; + } + if parse_binary(working_set, span).1.is_none() { return true; } diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index 3a8cc3e94b..2c392327f8 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -411,3 +411,8 @@ fn unary_not_6() -> TestResult { "def", ) } + +#[test] +fn date_literal() -> TestResult { + run_test(r#"2022-09-10 | date to-record | get day"#, "10") +}