I just want me to know how is it possible to optimize this code snippet?
$('#datedebut').change(function() {
if (Date.parse($('#datefin').val()) - Date.parse($(this).val()) <= 0) {
alert('Impossible');
}
});
$('#datefin').change(function() {
if (Date.parse($(this).val()) - Date.parse($('#datedebut').val()) <= 0) {
alert('Impossible');
}
});
I think it is repeating the same thing, but I do not know how to find something that is optimized and of course simple.
Thank you in advance for your proposal.