Date Time Picker for Warranty Start, Warranty End, Invoice Date in Same Page
var today = new Date(); var yyyy = today.getFullYear(); $('.purchase_date').datetimepicker({ viewMode: 'years', format: 'DD-MMM-YYYY', extraFormats: [ 'DD.MM.YY', 'DD.MM.YYYY' ], maxDate: today, minDate: '01/01/' + (yyyy - 60) }); $('.datepicker').datetimepicker({ viewMode: 'years', format: 'DD-MMM-YYYY', extraFormats: [ 'DD.MM.YY', 'DD.MM.YYYY' ] }); $('#warrantyStart').datetimepicker(); $('#warrantyEnd').datetimepicker({ useCurrent: false //Important! See issue #1075 }); $("#warrantyStart").on("dp.change", function (e) { $('#warrantyEnd').data("DateTimePicker").minDate(e.date); }); $("#warrantyEnd").on("dp.change", function (e) { $('#warrantyStart').data("DateTimePicker").maxDate(e.date); });