Good Afternoon All, I need a little help with a date calculation. What needs to happen is when the user enters a Start Date (plStartDate) and the number of DAYS the project is expected to run in the Project Length field (numProjectLength) these two fields will calculate an End Date(plEndDate). I also need the End Date to be null/empty until both the Start Date and Project Length have values which takes it from formCalc to JavaScript.
At the following link is a Designer Form that has two subforms. The first one is named Contract Term (subContractTerm), and it demonstrates the working code that I DO have but it calculates by months. The second subform is named Project Length (subProjectLengthDays) and has the same three objects but I need the formula to calculate by days NOT months. Any help is appreciated. Thanks!!
Solved! Go to Solution.
Views
Replies
Total Likes
Try this
if(plStartDate.rawValue!=null && numProjectLength.rawValue!=null){ var d = new Date(plStartDate.rawValue); var dd = new Date(d.setDate(d.getDate() + numProjectLength.rawValue)); var newDate = new Date(dd.setDate(dd.getDate()+1)); this.rawValue = (newDate.getMonth() + 1) + "/" + newDate.getDate() + "/" + newDate.getFullYear() this(newDate) }
Try this
if(plStartDate.rawValue!=null && numProjectLength.rawValue!=null){ var d = new Date(plStartDate.rawValue); var dd = new Date(d.setDate(d.getDate() + numProjectLength.rawValue)); var newDate = new Date(dd.setDate(dd.getDate()+1)); this.rawValue = (newDate.getMonth() + 1) + "/" + newDate.getDate() + "/" + newDate.getFullYear() this(newDate) }
Perfect! thank you so much!!
So sorry. - NVM. It works perfectly.