is there a way to process fields as date?
I have JSON with fiels of dates (in string format)
[{ "start": "2022-08-09T11:00:32.255Z", "end": "2022-08-09T15:38:00.000Z" }]
in result I want to get duration. something like duration: end.asDate() - start.asDate()
I found that API allows me to write custom methods. but I mostly use jora as part of discovery, and it does not allow to set custom functions
@zaverden "as part of discovery" means as part of browser's extension JsonDiscovery or Discovery.js itself? In first case, yeah, there is no way at the moment to add a custom method. In second case, you can add custom methods on prepare() handler.
unfortunatelly for me, it is JsonDiscovery extension.
@lahmatiy in general what do you think about adding build-in dates support to jora?
I can see at least 3 scenario:
- find difference between 2 date fields (
end.asDate() - start.asDate()) - human readable timestamp representation (
{ ts: 1660108462352 }->ts.asDate()) - get elapsed time (
now() - lastEvent.asDate())
@zaverden I see. Well, I'm going to add a wide set of methods (lang extensions maybe) to work with strings, numbers, dates etc. However, there are some issues I need to resolve first. I want to avoid adding the things that will be hard to remove or change in the future (without breaking queries that worked before). So I'm a bit too conservative in this area of changes. Anyway, I'm expecting that this gap will be filled in next 1-2 months.