Closed alexsnaps closed 3 months ago
This was a regression introduced in #40 (extension of changes in #33)
It is because of this trait https://github.com/clarkmcc/cel-rust/blob/2cb75cb3cc985583c199ea4891ddd5450d6b1beb/interpreter/src/context.rs#L50
Which ultimately calls this function, converting the timestamp to a string https://github.com/clarkmcc/cel-rust/blob/2cb75cb3cc985583c199ea4891ddd5450d6b1beb/interpreter/src/ser.rs#L577
Still thinking about exactly how to solve this. In the meantime, you can use this to add a Value
type directly and skip serialization.
context.add_variable_from_value("foo", Value::Timestamp(DateTime::default()))
I need to think through the repercussions of #68 but it does resolve the issue (test added). Because of this addition, I don't think there will be any breaking changes. We were effectively doing that before, just with an unnecessary intermediate serialization step.
I'm not sure whether I'm the one doing something here, but I find this slightly confusing:
Interestingly, this yields comparing:
Timestamp(2023-05-28T00:00:00+00:00) vs String("2023-05-28T00:00:00+00:00")
Where the lhs is thetimestamp('2023-05-28T00:00:00+00:00'
, but for some reasonts
ends up being a ...String
? Am I missing something here?