forked from extern/nushell
Fix bug in date comparison (#842)
This commit is contained in:
parent
988a873466
commit
6e44012a2f
@ -886,9 +886,7 @@ impl PartialOrd for Value {
|
||||
(Value::Float { val: lhs, .. }, Value::Float { val: rhs, .. }) => {
|
||||
compare_floats(*lhs, *rhs)
|
||||
}
|
||||
(Value::Date { val: lhs, .. }, Value::Date { val: rhs, .. }) => {
|
||||
lhs.date().to_string().partial_cmp(&rhs.date().to_string())
|
||||
}
|
||||
(Value::Date { val: lhs, .. }, Value::Date { val: rhs, .. }) => lhs.partial_cmp(rhs),
|
||||
(Value::String { val: lhs, .. }, Value::String { val: rhs, .. }) => {
|
||||
lhs.partial_cmp(rhs)
|
||||
}
|
||||
|
@ -161,3 +161,8 @@ fn divide_duration() -> TestResult {
|
||||
fn divide_filesize() -> TestResult {
|
||||
run_test(r#"4mb / 4mb"#, "1")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn date_comparison() -> TestResult {
|
||||
run_test(r#"(date now) < ((date now) + 2min)"#, "true")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user