Skip Navigation

[Resuelto] limit date picket dates/times

This support ticket is created hace 5 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Etiquetado: 

Este tema contiene 10 respuestas, tiene 2 mensajes.

Última actualización por Ido Angel hace 5 años, 6 meses.

Asistido por: Minesh.

Autor
Mensajes
#1254937

hey,
2 things:

1) i tried limiting the daye picker to only 3 years ahead from now, using this code:

  $( ".thedate" ).datepicker({
    minDate: 0,
    maxDate: 1095
  });

it worked, but i couldn't create an event anymore as no matter which date i chose, it gave a "this field is required" error.

2) is there a way to limit the minutes to 30 minutes intervals?

thx!

#1254943

Minesh
Supporter

Idiomas: Inglés (English )

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

Hello. Thank you for contacting the Toolset support.

Well - have you added the date field as date filter to your views? If yes, can you please share problem URL?

2) is there a way to limit the minutes to 30 minutes intervals?
==> where and how exactly you want to display this section and where you want to use it?

#1254953

Hey minesh,
I'm using it in a cred form for creating and editing events with a date field.

#1254967

Minesh
Supporter

Idiomas: Inglés (English )

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

Ok great - can you please share link where you added the form?

#1255001

Hey
It's here:

enlace oculto

Bit I removed the code. You can re add it, use the credentials from this thread here:

https://toolset.com/forums/topic/excerpt-from-custom-field-multilines-with-breaks/

You'll need them to see the page anyway..

Thx!

#1255023

Minesh
Supporter

Idiomas: Inglés (English )

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

I've added the following code to your Form's JS box to restrict the datepicker maxdate to 3 years from now:

jQuery(window).load(function() {
  id = jQuery('input[name="wpcf-event-date[display-only]"').attr('id');
    jQuery( "#"+id ).datepicker("option","minDate","0");
    jQuery( "#"+id ).datepicker("option","maxDate","+3Y");
});   
#1255053

Hey
Thx but I tried now and it allowed me to place date before today and in 5 years...
Also - could you please take a look at the second question?
Thx!

#1255055

Minesh
Supporter

Idiomas: Inglés (English )

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

Thx but I tried now and it allowed me to place date before today and in 5 years...
=> Please clear your browser cache and check. I can not able to select past dates as well as the allowed date is 3 years from now, thats maxdate.

2) is there a way to limit the minutes to 30 minutes intervals?
==> No, there is no solution for this. At least I do not have it.

#1255091

ok - thx!
i checked on desktop - works.
but in mobiles, even if i delete cache, it still doesn't work.
maybe it's the windows.load function?
any other idea?
thx minesh!

#1255097

Minesh
Supporter

Idiomas: Inglés (English )

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

Well - I do not know about mobile compatibility.

What if you try to add the following code to your form's JS box, Please remove the existing code:

jQuery(window).bind("cred_form_ready", function() {
  
     id = jQuery('input[name="wpcf-event-date[display-only]"').attr('id');
    jQuery( "#"+id ).datepicker("option","minDate","0");
    jQuery( "#"+id ).datepicker("option","maxDate","+3Y");
 
});
#1255101

Perfect Minesh!!!!! Thanks so much. Now I need to find how to make those intervals... 🙂