Skip Navigation

[Resolved] Query filter view not working corectly.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 3 months ago.

Assigned support staff: Waqar.

Author
Posts
#2096975

I am trying to: Show an event when the end date is greater or equal to today.

Link to a page where the issue can be seen: It's a intranet where you need to be logged in.

I expected to see: That the event shows up if the end date is greater than or equal to today.

Instead, I got: That the event doesn't show when the end date is equal.

So i have setup a start date and end date for the events custom post. I used the date custom fields for that.

On the view i added the Query filter "Event End Date is a number greater than or equal TODAY()"

As long as the end date is greater it works fine. But if the end date is equal then it doesn't show. I also tried the Query filter "Event End Date is a number equal to TODAY()" but that doesn't work either. So it seems the "equal to" doesn't do anything.

"Greater than" "Lower than" etc all work. Except for "Equal".

Hope you guys can help out.

Thanks
Guido

#2097559

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Guido,

Thank you for contacting us and I'd be happy to assist.

I've performed some tests on my website and couldn't reproduce this issue.

I added a date type custom field that required input of only the date (and not the time) and then tested the query filter for both cases, which worked as expected:

1. Date field is a number equal to today
2. Date field is a number greater than or equal to today

An important point to remember is that when a date field is used without the time, it stores the selected date with the time "12:00 am", in the Unix timestamp format. For date-time comparisons, the functions like TODAY(), also use the same time as the reference.

However, if someone is using the date field with time input as well, then the Unix timestamp number would be different from the one at "12:00 am" on that date. For that case, it would make sense to compare it with FUTURE_DAY with value 1 (i.e. tomorrow) instead of today.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar