### [Disabling Past Times On the Time Picker](https://wpforms.com/developers/how-to-disable-past-times-on-the-time-picker/)

**Published:** January 21, 2022
**Author:** David Ozokoye

**Excerpt:** In this tutorial, we'll show you how to disable the past times from the time picker field using JavaScript. 

**Content:**

Would you like to disable past times when using the Date / Time field with WPForms? On your form, you may want to disable any times that have already passed for the day, which is currently not supported by default in WPForms.

 In this tutorial, we’ll show you how to disable past times with a custom JavaScript snippet.

---

## Creating Your Form

First, we’ll start by creating our form and adding our fields which will include at least one **Time** field.

If you need any assistance in creating your form, [please review this documentation](https://wpforms.com/docs/creating-first-form/ "How to Create Your First Form").

Once you’ve added the **Time** field, click on the **Advanced** tab and set your **Interval**. For this demo, we’ve set our to **15 minutes**.

![create your form and add your time field. you will need to set the interval level as well](https://wpforms.com/wp-content/uploads/2022/01/add-time-field-wpforms.jpg)## Adding the Snippet

In order to automatically disable past times, we’ll need to add a snippet to our site. Before getting started, [please review this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms") if you need help with adding custom code snippets in WordPress.

The snippet will look for the form ID of **999** and will only be applied to the field ID **8**. In addition to disabling past times, it will also round up as well so you don’t get time selections like **9:37** showing up as an option.

You’ll need to update each instance of **window.wpforms\_999\_8** to match your own form and field IDs. If you need help finding those IDs, [please check out this tutorial](https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ "How to Locate Form ID and Field ID").

That’s it! You now know how to disable past times in the Date / Time field.

Next, would you like to also create your own **Intervals** for the **Time** field? Check out our tutorial on [creating additional intervals for the Date / Time field time picker.](https://wpforms.com/developers/how-to-create-additional-intervals-for-the-date-time-field-time-picker/ "How to Create Additional Intervals for the Date Time Field Time Picker.")

## Related

Action Reference: [wpforms\_wp\_footer\_end](https://wpforms.com/developers/wpforms_wp_footer_end/ "Using the wpforms_wp_footer_end action")

**Categories:** Tutorials

**Tags:** Javascript, JS

---

