Skip Navigation

[Résolu] format filter date selectfield

This support ticket is created Il y a 1 année et 8 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Waqar Il y a 1 année et 8 mois.

Assisté par: Waqar.

Auteur
Publications
#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:
lien caché

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