Any tips on optimizing this code?if (!Modernizr.inputtypes.date) {    $(function () {        var d = Date.parse($('#StartDatePicker').val());        $('#StartDatePicker').val($.format.date(d, yyyy-MM-dd hh:mm a));        d = Date.parse($('#EndDatePicker').val());        $('#EndDatePicker').val($.format.date(d, yyyy-MM-dd hh:mm a));        var startDateTextBox = $('#StartDatePicker');        var endDateTextBox = $('#EndDatePicker');        startDateTextBox.datetimepicker({            dateFormat: yy-mm-dd,            timeFormat: hh:mm TT,            minuteGrid: 10,            addSliderAccess: true,            sliderAccessArgs: {                touchonly: false            },            onClose: function (dateText, inst) {                if (endDateTextBox.val() != '') {                    var testStartDate = startDateTextBox.datetimepicker('getDate');                    var testEndDate = endDateTextBox.datetimepicker('getDate');                    if (testStartDate > testEndDate) endDateTextBox.datetimepicker('setDate', testStartDate);                } else {                    endDateTextBox.val(dateText);                }            },            onSelect: function (selectedDateTime) {                endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate'));            }        });        endDateTextBox.datetimepicker({            dateFormat: yy-mm-dd,            timeFormat: hh:mm TT,            minuteGrid: 10,            addSliderAccess: true,            sliderAccessArgs: {                touchonly: false            },            onClose: function (dateText, inst) {                if (startDateTextBox.val() != '') {                    var testStartDate = startDateTextBox.datetimepicker('getDate');                    var testEndDate = endDateTextBox.datetimepicker('getDate');                    if (testStartDate > testEndDate) startDateTextBox.datetimepicker('setDate', testEndDate);                } else {                    startDateTextBox.val(dateText);                }            },            onSelect: function (selectedDateTime) {                startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate'));            }        });    });}
Date/Time picker for browsers that don't support the datetimelocal input
javascript;performance;jquery;datetime