Hi Tom,
You can probably do this with the ChronoForms datepicker but that may not be the simplest solution.
I built a test form using the
Date Range Picker scripts that does what you need (see my test
here ).
Here's how it is built:
+ In your form Designer tab add a text input and give it the name and id 'daterange'
+ In the Setup tab add a Load CSS action before the HTML (Render form) action and add this in the CSS Files box
http://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css
+ Similarly add a Load JS action and add this in the Load JS Files box
http://cdn.jsdelivr.net/momentjs/latest/moment.min.js
http://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js
+ Lastly in the JS Code box of the same action add this:
jQuery(document).ready(function (jQ) {
jQ('#daterange').daterangepicker();
jQ('#daterange').after('<span id="days"></span>');
jQ('#daterange').on('apply.daterangepicker', function(ev, picker) {
var start, end, days;
start = picker.startDate;
end = picker.endDate;
days = end.diff(start, 'days');
jQ('#days').html(days+' Days');
});
});;
+ Test the form.
This version just shows the number of days below the datepicker input - you can alter that to show it somewhere else and/or set the value of a form input so that it is submitted.
Check the Date Range Picker docs for many other options.
Note: this loads the moment.js library which also contains a full range of date and time handling
options.
Bob