We help IT Professionals succeed at work.

Javascript alert if the date in a text field is less than ninety days from now

ddantes
ddantes asked
on
I am not trained in scripting.  The online reservation system for my website includes a page (attached) with a text field "ArrDate".  I'd like an alert to pop up if someone enters a date which is less than ninety days from the current date.  Please provide instructions, if this is possible.
bf0001.html
Comment
Watch Question

Try this code
var timestamp = new Date().getTime() + (90 * 24 * 60 * 60 * 1000)
//                                      day hour  min  sec  msec
var arrDate = \\fetch date here and getTime()
Compare that timestamp with the timestamp for the selected date.

if (timestamp > selectedTimestamp) {
    alert(' The selected time is less than 90 days')

}

Open in new window

Author

Commented:
Thank you for supplying that code.