I\'m creating an application which lets you define events with a time frame. I want to automatically fill in the end date when the user selects or changes the start date.
If using moment.js, there is a simpler solution, which will give you the difference in days in one single line of code.
moment(endDate).diff(moment(beginDate), 'days');
Additional details can be found in the moment.js page
Cheers, Miguel