Comparing the date entered to ensure it is between today and 4 weeks from now
Good morning
I've tried a number of different approaches but can't seem to get this to work. I'm building a PDF Form in Adobe Pro DC to be used by our staff. I have an Appointment Date field (appt_date) and I need to verify that the date the user entered is between today and 4 weeks from now. I've seen a lot of code samples but the dates are always provided in the code, which doesn't help me.
Any help would be appreciated. This code snippet is the last one I've tried, but it's not working (I think this was a "pure javascript" example rather than "Adobe JavaScript"). Thanks in advance!
Chris
var dateFrom = "01/08/2017";
var dateTo = "01/10/2017";
var dateCheck = "05/09/2017";
var d1 = dateFrom.split("/");
var d2 = dateTo.split("/");
var c = dateCheck.split("/");
var from = new Date(d1); // -1 because months are from 0 to 11
var to = new Date(d2);
var check = new Date(c);
alert(check > from && check < to);
