replied on December 15, 2014
Should be fairly simple with Javascript Dates...
$('.DateClass input').change( function () {
var t1 = new Date($('.StartDate input').val());
var t2 = new Date($('.EndDate input').val());
$('.DateDiff input').val(Math.floor((t2-t1)/(1000*60*60*24)));
});
Here, I have DateClass on both my date fields, which should catch any changes to either field. Additionally, the start date has a StartDate class and the end date has the EndDate class. Finally, the Difference field has the DateDiff class. You should probably add some code to handle the case for when an invalid date is entered into one of the fields. You may also need to adjust the difference by 1 day if the difference you are looking for is inclusive of the end points.
This works by taking the dates from the fields as a string value and converting it to a Javascript Date class. You can add/subtract these dates (which just store time by counting in milliseconds the time since Jan1 1970). Then, you can just divide out various time factors to convert the units to days/months, years, etc. You may need to be careful if your dates are from different time zones, but other than that it should work well. At any rate, that should get you started.