Skip Navigation

[Resolved] Disable future dates/times in a date field.

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 3 replies, has 2 voices.

Last updated by Minesh 1 year, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2651011

Tell us what you are trying to do?
I have a form using a field group with a date field. The date field records the date and time that an actual observation occurred, so this cannot be in the future! I need to restrict the date picker so future date/times are not available.

Is there any documentation that you are following?
I can't find anything appropriate.

Is there a similar example that we can see?
Maybe? When adding the date field to the form I can see there is some form of validation. But I can see no way to configure this. There is an option to enable/disable validation, but a setting for the validation rules appears to be hidden/missing.

What is the link to your site?
https:riverinawildlifehealth.com.au

#2651113

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

You will have to add custom Javascript/Query code in order to disable the future date for your datepicker field.

Please check the following related ticket that might help you
- https://toolset.com/forums/topic/cred-date-field-not-working/#post-1217387
- https://toolset.com/forums/topic/split-custom-date-field-not-working-on-edit-post-form/#post-1218343

If your require further assistance, please share problem URL where you added the form as well as for what date custom field you want to disable the future date selection.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2651357

Thanks Minesh! The datepicker now limits the date range.

One issue remains. The datepicker is not respecting the time zone selected in WordPress. When I select a date/time, the result is UTC+0. Do you have code to set the CRED datepicker time-zone?

#2651383

Minesh
Supporter

Languages: English (English )

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

As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported with this ticket.

May I kindly ask you to open a new ticket with every new question you may have. Thank you for understanding.