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

Support date comparisons, e.g. less than, greater than #3480

Open
patkujawa-wf opened this issue Dec 4, 2024 · 0 comments
Open

Support date comparisons, e.g. less than, greater than #3480

patkujawa-wf opened this issue Dec 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@patkujawa-wf
Copy link

patkujawa-wf commented Dec 4, 2024

Problem to solve

I've captured two dates and want to assert that one is earlier than the other, but I get a type error:

65 | jsonpath "$.results[0].created_at" toDate "%+" format "%a, %d %b %Y %H:%M:%S" toDate "%a, %d %b %Y %H:%M:%S" < {{ request_date }}
   |   actual:   date <2024-12-04 17:54:52 UTC>
   |   expected: less than date <2024-12-04 18:26:57 UTC>
   |   >>> types between actual and expected are not consistent

Proposal

Expand the comparison predicates (e.g. https://hurl.dev/docs/grammar.html#less-predicate) to allow dates as well as the current numbers and strings.

Relates somewhat to #798

Alternatives

I see that https://hurl.dev/docs/filters.html#daysbeforenow is one filter, but I need something on the order of seconds rather than days, so perhaps a secondsBeforeNow filter could be used for both dates (or in my case I can just hardcode a value of 5 seconds).

@patkujawa-wf patkujawa-wf added the enhancement New feature or request label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant