Skip Navigation

[Resolved] Filter a View by Date

This thread is resolved. Here is a description of the problem and solution.

Problem

How can I add a Custom or Query Filter by a Toolset "Date" Post Field?

Solution

Custom Date Filters and queries are a large topic in the query section.

Depending on what date and comparison you search for, you must pay attention to what kind of data you compare it to.

Usually, you want to use

UNSIGNED

, however, there are exceptions.
Please consult the DOCs linked below.

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by Tyler 6 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#621558
after date.png
before date.png

I am trying to: I am trying to create a filter by day. However, I also need a "start time and end time." So I have a start time and end time fields with the option of "input date and time" selected. However, because I have that selected I can no longer do any kind of filters on the date. For example, I want to show everything that happens on a specific day. However, because the field is set to the date and time option none of the date filter options seem to work anymore.

Link to a page where the issue can be seen: hidden link
Here I've put the filter at the top. When you select a date everything goes away.

I expected to see: I expect to be able to have a start and end time and use one of those fields to filter for date. It seems the only way to do this is to create ANOTHER date field that doesn't have time. Which isn't a big deal, but it means the user has to enter the date 3 different times to get a date that is filterable and start and end time. That is just ridiculous.

Instead, I got:

#621680
Bildschirmfoto 2018-03-03 um 10.24.32.png

This Custom Search finds no posts to display:

No project have been created for this date yet.

.

This means no post matched the search.

The Search there is a Field that filters posts by the Date as set for each post in the related Custom Field.
It seems there is no post with that exact value set.

You can filter for values "between" 2 values, in Toolset Views.
When you add the Custom Filter, you will see an option to choose what comparison to use (see ScreenShot)

This as well works with Date Fields.
It will automatically generate 2 date pickers on the Front End to choose from.

This is how you would let users filter for values between 2 dates using Toolset.

Toolset, however, does not include a pure Time Picker.

Hence, if you need to choose between days AND time and those may be repeating (same time, but a different day), I suggest using another, additional Custom Field for the Time (as an example a simple select, with 24 hours and 60 minutes, or similar).

Yes, that would then need the user to enter at least 4 values (start and end for both date and time), if you want to have this flexible it is the only way to achieve this (using Toolset).

#622206

That is a good suggestion. I like the idea of just using the date and setting the time using dropdowns so that's what I will do.

However, the real heart of my question is how do I filter for date if I use the date field and set it to "date and time." Do I call it using a "string" is that what I was missing?