Skip Navigation

[Resolved] Conditional output views for comparing datetime just by date

This support ticket is created 5 years, 9 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
- 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 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1211309

Tell us what you are trying to do?
I want to compare start and end datetime just by date not by time.

my View Template:
[wpv-post-link]
[types field='kurs-kurzbeschreibung'][/types]

[wpv-conditional if="( $(wpcf-kurs-start) eq $(wpcf-kurs-ende) )"]
[types field="kurs-start" index="0"][/types]
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-kurs-start) eq $(wpcf-kurs-ende) )" evaluate="false"]
[types field="kurs-start" index="0"][/types]
bis [types field="kurs-ende" index="[types field='kurstage' output='raw'][/types]"][/types]
[/wpv-conditional]

at "[wpv-conditional if="( $(wpcf-kurs-start) eq $(wpcf-kurs-ende) )" i just want to compare the date and not the datetime to control if start datetime and end datetime is at the same day.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

the result is on the page
hidden link
http protection: toolset:562VFHjfv

The last entry should just have one Date, but as start-time and end-time are not equal it shows the same date twice.

#1211357

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - what if you try to check the date field using the Types shortcode.

For example:

[wpv-conditional if="( '[types field='kurs-start' style='text' format='F j Y'][/types]' eq '[types field='kurs-ende' style='text' format='F j Y'][/types]')"]


// add your code here

[/wpv-conditional]
#1211400

The first one seems to be allways true?!
hidden link

can it be it's because of the brakets " ' ' ' ' " ?

[wpv-conditional if="( '[types field='kurs-start' style='text' format='F j Y'][/types]' eq '[types field='kurs-ende' style='text' format='F j Y'][/types]')"]
course with one day
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-kurs-start) eq $(wpcf-kurs-ende) )"]
[types field="kurs-start" index="0"][/types]
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-kurs-start) eq $(wpcf-kurs-ende) )" evaluate="false"]
[types field="kurs-start" index="0"][/types]
bis [types field="kurs-ende" index="[types field='kurstage' output='raw'][/types]"][/types]
[/wpv-conditional]

#1211700

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sorry - I need to know here is the kurs-start and kurs-ende fields are repeating fields?

If yes, what index you want to match to compare the start and end date?

In addition to that, I do not able to open the link you shared. I get the following error:

ERR_CONNECTION_TIMED_OUT

When I checked with one of my colleagues, for him the link you shared works fine. Is there any IP restrictions?

#1211734

No restrictions as far as i know.

Yes both are repeating fields.

With index="[types field='kurstage' output='raw'][/types]"] i match the last index for kurs-ende (course ende)

This works fine. kurstage= course days (-1) so that „0“ is course with one day wich will have just on daytime els the should get starting and end day.

Greetings Torsten

#1211799

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

With index="[types field='kurstage' output='raw'][/types]"] i match the last index for kurs-ende (course ende)
==> so, using above we get the end date for the field "kurs-ende" - do we also need to use index for start date field as well? what index we need to check for start date field - is it 0 index for start date field?