What are common issues encountered when initializing Datepicker in modal windows in PHP?

When initializing Datepicker in modal windows in PHP, a common issue is that the Datepicker may not work properly due to the modal window being dynamically generated after the page has loaded. To solve this, you can initialize the Datepicker after the modal window has been fully loaded and displayed.

// Initialize Datepicker after modal is shown
$('#myModal').on('shown.bs.modal', function () {
    $('#datepicker').datepicker();
});