Skip Navigation

[Resolved] format filter date selectfield

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2583601

Hi,

i wont to give a filter in view to filter posts with a date field:

[wpv-control-postmeta field="wpcf-letzter-termin" date_format="F j, Y" url_param="wpv-wpcf-letzter-termin" default_label="bitte Datum auswählen" type="select"]

it gives all dates but in timecode. How can i format this to date_format="F j, Y" or to date_format="m Y"?

Here is a category and the date filter:
hidden link

thx for helping in acvance - alex

#2583955

Hi Alex,

Thank you for contacting us and I'd be happy to assist.

I found a previous ticket, where we've discussed this topic before:
https://toolset.com/forums/topic/filter-did-not-work-with-date-field

For the date type custom fields, the select type search field filter is not supported. It only allows a date picker or a text input field, which is why you're seeing the raw, timestamp values when you change the field type to "select".

The custom code snippet shared in this reply should still work to convert the timestamp text into the formatted date:
https://toolset.com/forums/topic/filter-did-not-work-with-date-field/#post-2475543

Note: You'll replace the the current field's name in that code snippet, so that this line:


jQuery('select[name="wpv-wpcf-letzter-termin_min"] option, select[name="wpv-wpcf-letzter-termin_max"] option').each(function () {

Will become:


jQuery('select[name="wpv-wpcf-letzter-termin"] option,').each(function () {

I hope this helps and please let me know if you need further assistance.

regards,
Waqar