In the end, I figured it out. It doesn't register if the datepicker is added dynamically to the page. For a good explanation and a solution, see the following:
jQuery datepicker won't work on a AJAX added html element
Thanks to everyone that tried to help :-).