CMS Development

SumitP
Member

Disable past dates in the datepicker field

I want to disable the past dates in the datepicker fields and can't find a solution for that. I am aware that we are using Pikaday.js for the forms datepicker and there are solutions for that in pikaday if we using it directly however unable to use the same solution in hubspot using the same snippet.

 

Below is the snippet, which disables the dates and can be seen live at https://pikaday.com/ 

 

var picker = new Pikaday(
{
field: document.getElementById('datepicker'),
firstDay: 1,
minDate: new Date(),
maxDate: new Date(2020, 12, 31),
yearRange: [2000,2020]
});

 

 

Please help me with a snippet of something which could help disabling the past dates.

3 Replies 3
MFrankJohnson
Thought Leader

Disable past dates in the datepicker field

- see Form fields custom validation

- see How to work with jquery custom validation for hubspot form

 

Help answer your question? If so, remember to accept this solution now.

 

Best,
Frank

Chief HubSpot Consultant


hubspot-solutions-signature-mfrankjohnson-v05.png

MFrankJohnson.com | Perfect HubSpot Series | Connect on LinkedIn

Help find posts quickly ... accept this solution now.

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
jennysowyrda
Community Manager
Community Manager

Disable past dates in the datepicker field

Hi @SumitP,

 

Do you mind providing some additional information around your end goal? Are you looking to have users pick a date in a form and only be able to choose days in the future? 

 

Do you have a link to the page where your form is currently set up?

 

The more information, screenshots and details you can provide, the better the Community can assist!

 

Thank you,
Jenny

0 Upvotes
SumitP
Member

Disable past dates in the datepicker field

Here is the screenshot of the form, Unforturnely can't share the page, The end Goal is to block past dates from the date picker calender. In the screenshot you will see the field name says, Launch Date which should be a future date however user end up adding any past dates accidently. Many hubspot are looking for this solution, we ourself have Scheule meeting, Schedule a Demo etc field for which its very important to have passt dates blocked.

 

 

Untitled-2.jpg

0 Upvotes