creativetimofficial / ct-paper-dashboard-pro-angular

8 stars 10 forks source link

Multiple datepicker issue #18

Closed akashsherkar closed 5 years ago

akashsherkar commented 6 years ago

When i have 2 datepickers in the same form the first one works and the other does not. both have different initializations with 2 different id's. Also, if i open the browser console by f12 then both of them seem to work.

Here is the initialization

$('#startDate').datetimepicker({ format: 'YYYY-MM-DD', // use this format if you want the 12hours timpiecker with AM/PM toggle icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', previous: 'fa fa-chevron-left', next: 'fa fa-chevron-right', today: 'fa fa-screenshot', clear: 'fa fa-trash', close: 'fa fa-remove' } }); $('#endDate').datetimepicker({ format: 'YYYY-MM-DD', // use this format if you want the 12hours timpiecker with AM/PM toggle useCurrent: false, icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', previous: 'fa fa-chevron-left', next: 'fa fa-chevron-right', today: 'fa fa-screenshot', clear: 'fa fa-trash', close: 'fa fa-remove' } });

$('#startDate').on('dp.change', function (e) {
    $('#endDate').data('DateTimePicker').minDate(e.date);
});
$('#endDate').on('dp.change', function (e) {
    $('#startDate').data('DateTimePicker').maxDate(e.date);
});