Skip Navigation

[Resolved] Date field – need to make it choose between two dates range.

This support ticket is created 2 years, 1 month 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.

Our next available supporter will start replying to tickets in about 1.49 hours from now. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by terryR 2 years, 1 month ago.

Author
Posts
#2325007

Tell us what you are trying to do?
Date field - need to make it choose between two dates range.

Example - there is an event and this event is going to last 3 days. Is there a way to make the date field havign the option to choose from date X to date Y.

Thank you.
Kind regards.

#2325033

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Are you talking about entering data, or using the data (such as filtering)?

If you refer to entering data, you would add separate date fields for the from date and the to date, you cannot include a range of dates in a single field.

#2325039
Screenshot 2022-03-23 155518.png
Screenshot 2022-03-23 155223.png
Screenshot 2022-03-23 155130.png

Is this correct ?
Then would the dates - 24,25,26 which are between 23 and 27th be displayed in the search field as results for the specific date range on the post as well ?
I am attaching screenshot on the search field in front-end too.

Thanks.

#2325099

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

You can make a field accept multiple instances, but there are no guarantees that they will be stored and retrieved in some expected order. The values will be stored in wp_postmeta for the given post_id, but you can't be sure that the first value will always be the from value and the second value the to value.

And that also means they cannot be used sensibly in search filters as there is no way to distinguish start and finish dates.

You should create separate start and finish date fields.

#2328273

My issue is resolved now. Thank you!
Hey I figured another way of how to make the dates to work for me.

Kind regards.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.