The problem I wrote about yesterday is finally fixed. The solution is pretty strange, but somehow works. I ended up having datepicker initialized through class name (not ID) as follows:
setTimeout(function() { $('.datepicker_element_class').removeAttr('id').removeClass('hasDatepicker').datepicker(); },300 );