Skip Navigation

[Resuelto] Filtering by custom field date range

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I have tried to add a custom field date filter but it doesn't seem to work correctly. No results are found in the View, but there are posts that have matching custom field date values. The filter is configured as "The field Online Event Date is a DATE that is greater than or equal the following: TODAY"

Solution: The "DATE" data format doesn't work well with Types date fields, counter-intuitively. It's best to choose the number or unsigned data type when filtering by a custom date field created in Types.

This support ticket is created hace 4 años, 1 mes. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Craig hace 4 años, 1 mes.

Asistido por: Christian Cox.

Autor
Mensajes
#1665771

I am trying to display a view based on date. I have my CPT (Online Events) with entries which have dates set before and after today. These all display fine when "The field Online Event Date is a DATE that is greater than or equal the following: TODAY" is removed. But as soon as I add it in, I get the message that no online events can be found.

Any ideas as to why the view won’t work when this filter is enabled?

Kind regards,
Craig

#1667169

Hi, is the "Online Event Date" field a custom date field created in Types? If so, then it's best to change the comparison from a DATE datatype to a number datatype:
The field Online Event date is a NUMBER that is greater than or equal the following: TODAY

Types date fields store dates in the database using a Unix timestamp format, which is basically an integer. If you're making comparisons against it you should choose "number" as the datatype. Let me know if this filter still doesn't behave as you'd expect and we can take a closer look.

#1667311

Hi Christian.

That has solved the issue. I never thought to try NUMBER. Duly noted.

Thank you very much for your help.

Kind regards,
Craig

#1667313

My issue is resolved now. Thank you!

Este ticket ya está cerrado. Si eres cliente de Toolset y necesitas ayuda relacionada, abre un nuevo ticket de soporte.