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 $NOW in conditional fields #14759
Comments
Further update. Condition works when using static set date. eg. |
Ah further update. When I said the previous comment that the condition works using a static value, I was mistaken. It doens't throw the |
It sounds like the dynamic variables aren't parsed (correctly) before the rule check is performed in conditions, that'd explain why you'd get a valid date reference problem 🤔 |
Yeh I checked the source, there is a parseFilter missing during that call
…On Mon, 1 Aug 2022, 15:45 Rijk van Zanten, ***@***.***> wrote:
It sounds like the dynamic variables aren't parsed (correctly) before the
rule check is performed in conditions, that'd explain why you'd get a valid
date reference problem 🤔
—
Reply to this email directly, view it on GitHub
<#14759 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSVMWWQ3Y6NK54JR6ZAS23VW7IH3ANCNFSM55DXXN4A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
However in addition to that, I checked the payload/context being validated as well, and it is not loading the relationship data before checking either. So the validation still fails. Any changes to validatePayload recently? |
We are also experiencing the same bug using a same kind of validation filter: What version of Directus are you using? What version of Node.js are you using? What database are you using? What browser are you using? How are you deploying Directus? |
Actually had a PR that fixed this, but closed it due to the new $CURRENT_ITEM PR which seems to also have stagnated. |
what is the status of this issue? |
We're re-architecting how Directus fetches data in the first place, which is where we're adding proper support for using current / other items in filters etc. It's the same reason the json query support in the current setup was paused, as we'd rather focus that effort on putting it in the new system in a foundational level 🙂
It's marked as a medium priority bug right now, which means that we gotta prioritize some higher prio stuff first. You're more than welcome to open a PR for the $NOW fix though! |
I think #14788 was supposed to fix it, but was closed in favor of #14887 |
This issue still seems to be prevalent. Unable to do validation using the |
Surprisingly, as of v10.2.3, if it does not work as a Fields' Collection validation, it does work at the Collection validation in the Roles.
|
Describe the Bug
After setting a condition on a field that includes checking a date field, I get an error after trying to insert a new item.
Not sure if it is due to the depth of the relationship or the
$NOW
have also tried$NOW()
To Reproduce
I have the following collections.
Check-ins->Registrations<-Event
On check-ins the
registration
field has the following condition:{ "registration": { "event": { "open_date": { "_lt": "$NOW" } } } }
Errors Shown
{"errors":[{"message":"date must have a valid date format or reference","extensions":{"code":"INTERNAL_SERVER_ERROR"}}]}
What version of Directus are you using?
9.14.5
What version of Node.js are you using?
16.4.0
What database are you using?
mysql 8
What browser are you using?
chromium
How are you deploying Directus?
Locally & GCP
The text was updated successfully, but these errors were encountered: