I am looking to implement a validation in JavaScript or TypeScript for Angular where the start date cannot be more than 60 days after the end date is entered. The requirement is to enforce a "maximum range of 60 days" between the two input dates (dateFrom and dateTo). Hi there, I need help with JS or Angular TS to ensure that the start date is not more than 60 days after the end date is entered. The rule to follow is a "maximum range of 60 days" for the input dates.
datepicker(){
var dateFrom = this.consultaForm.get('desdeCreacion').value;
var dateTo = this.consultaForm.get('hastaCreacion').value;
if(dateTo > (dateFrom < this.datePipe.transform(new Date(dateTo).getTime()-5100000000), 'yyyy-MM-dd')){
alert('Rango máximo 60 dias');
window.location.reload();}
}