I have a problem when trying to compare dates within a range using the === operator. The current implementation does not support this.
range = Date.parse('2024-01-01')..Date.parse('2024-12-31')
date = Date.parse('2024-07-22')
rule = {
"===" => [
{ "var" => "range" },
{ "var" => "date" }
]
}
data = {
"date" => date,
"range" => range
}
result = JSONLogic.apply(rule, data)
# expected result is true, but in all cases it returns false
We could add the command "==="
|
'===' => ->(v, d) { v[0] == v[1] }, |
'===' => ->(v, d) { v[0] === v[1] },
I have a problem when trying to compare dates within a range using the === operator. The current implementation does not support this.
We could add the command "==="
json-logic-ruby/lib/json_logic/operation.rb
Line 88 in 1fe6722