mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
Fix bug in date comparison (#842)
This commit is contained in:
parent
988a873466
commit
6e44012a2f
2 changed files with 6 additions and 3 deletions
|
@ -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 a new issue