Closed xarses closed 1 year ago
Right now you can't coerce a string into a datetime value. You'd need to parse it in Python yourself and pass it in as a datetime.datetime
instance instead of a string.
Now having said that, I've started working on #32 and I'll add $parse_datetime
to my list of initial functions. Once that's done you'll be able to do something like $parse_datetime(cfg.created) > $today
and it'll work. There is currently no ETA on when that'll be done.
Until then though, you'll have to parse the string yourself and pass the datetime.datetime
instance in the object you're evaluating.
I have data structures that may contain strings that are serialized dates.
Simplified I'm trying to read
I have a rule like
"[ cfg for cfg in config if cfg.created > $today ]"
I'm trying to have it explicitly cast to a datetime so I can evaluate the date, but no matter what I try, I can't find a flexible way to resolve it and keep a flexible description of the given objectWhen parsing I get
If I change this to what appears to be the way to coerce it to a date, it still freaks out (both
cfg.created.date
and(cfg.created).date
)If I load a context and explicitly declare the date it can resolve the value, but It doesn't look like there is a way to do this with out declaring the type for every possible object we want to access.