Verifiying Dates that a User inputs


my goal is to have the user input a date as a data entry for 2 weeks in the future. Is there a way I can set-up a verification to ensure they are entering the  correct date on an ongoing basis?

I have set-up a variable using javascript for the date 2 weeks in the future. 

I have attached my story to hopefully help explain what I am trying to do

Thank you


2 Replies
Kamil Nowek

Hello Jen,

it's very difficult for me to understand your story file, but I prepared for you JS code which show current date and date after 14 days. It should be helpful for you.

var now = new Date();
var after_two_weeks = new Date(now.getTime()+86400000*14);//1 day is 86400000 miliseconds so we need to multiply it by 14
var day = (now.getDate()<10)?"0"+now.getDate():now.getDate();
var month = ((now.getMonth()+1)<10)?"0"+(now.getMonth()+1):(now.getMonth()+1);
var year = now.getFullYear();
alert("current date "+day+"."+month+"."+year);
day = (after_two_weeks.getDate()<10)?"0"+after_two_weeks.getDate():after_two_weeks.getDate();
month = ((after_two_weeks.getMonth()+1)<10)?"0"+(after_two_weeks.getMonth()+1):(after_two_weeks.getMonth()+1);
year = after_two_weeks.getFullYear();
alert("after_two_weeks "+day+"."+month+"."+year);

Christie Pollick

Hi, Jenn -- I see that Kamil has provided you with a suggestion; please let us know if it is what you are looking for. And although we don't provide support for JavaScript, it may be helpful to take a look at this document on JavaScript Best Practices. Hopefully, some of our experts in the community can chime in with other suggestions if you need them!