Saltar navegación

[Resuelto] conditional display comparing dates with today

This support ticket is created hace 4 años, 6 meses. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por fabriceS hace 4 años, 6 meses.

Asistido por: Minesh.

Autor
Mensajes
#1927693

My CPT have a field of availability which is a date.

when I display that date, I'd like to create a conditional display and display the date if it is in the future, but if the availability date is today or before, I'd like to display a kind of "available now".

How can I compare the dates ?

Thanks for your help.

#1927965

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can use the TODAY() function to compare your custom date field.

For example:

[wpv-conditional if="( '[types field='date-field' output='raw'][/types]' lte 'TODAY()' )"]
available now
[/wpv-conditional]
[wpv-conditional if="( '[types field='date-field' output='raw'][/types]' gte 'TODAY()' )"]
Display your date field
[/wpv-conditional]

Please check the following:
https://toolset.com/documentation/legacy-features/views-plugin/debugging-views-output/

#1935501

My issue is resolved now. Thank you!