Tell us what you are trying to do?
I created 2 custom post types with toolset: Courses and Dates
They have a Relationship One-to-many (Courses-to-Dates). One course would have many dates
Dates have a date custom field called Starting date
I created a template for Courses where I show all the Course info. Below it I wanted to show the next dates (from Dates cpt).
I can list all dates perfectly. Past and future dates are showing.
I wanted to show ONLY future dates, so I added a filter to this view with these conditions: Starting date is a DATE greater than TODAY()
In the design view (backend of template), I can see only the one of future dates, but the following message:
There were no posts found to display for this View's query.
I found that if I use STRING instead of DATE in the filter, it works perfectly.
Starting date is a STRING greater than TODAY()
This is a solution I know, but I was wondering why the filter doesn’t work using DATE.
Is there any documentation that you are following?
https://toolset.com/course-lesson/filtering-toolset-views-by-dates/
Is there a similar example that we can see?
Not really
What is the link to your site?
It's a Local site
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Toolset date custom field value is stored as Unix Timestamp in the database. So the correct data type you should use with your filter is "number" instead of "string".
What if you set the "number" with your date custom field query filter - does that works?
Minesh, thank you for your detailed explanation!
I tried setting as a number the custom field query filter and it worked too, thanks!
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Glad to know that solution I shared help you to resolve your issue. Can you please mark this ticket as resolved.
My issue is resolved now. Thank you!