Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to process fields as date? #37

Open
zaverden opened this issue Aug 10, 2022 · 3 comments
Open

is there a way to process fields as date? #37

zaverden opened this issue Aug 10, 2022 · 3 comments

Comments

@zaverden
Copy link

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

@lahmatiy
Copy link
Member

@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.

@zaverden
Copy link
Author

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:

  1. find difference between 2 date fields (end.asDate() - start.asDate())
  2. human readable timestamp representation ({ ts: 1660108462352 } -> ts.asDate())
  3. get elapsed time (now() - lastEvent.asDate())

@lahmatiy
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants