OK, I've narrowed down the section of code that's causing the error - the calculations in the form were generated by SpreadsheetConverter and there's a big chunk of script after the closing <body> tag, which contains something that's conflicting with the datepicker. If I remove all of that code, the datepicker works but then of course the calculation doesn't! I'll raise a support ticket with SpreadsheetConverter to see if they can advise!