Compare two dates with YYYY-mm-dd format in javascript

1

I'm in trouble with a little comparison of dates, I need to compare two dates in the format "2018-10-05" to be able to call a function or do calculations, I was reading and I'm really complicating my life, someone could give me Help? I read them thank you very much

function CompararFechas(fechaVencimiento,fechaPago){
    var fechaVencimiento   = fechaVencimiento;
    var fechaPago          = fechaPago;

    if (){
    } else if (){   
    }
}
    
asked by Fede 11.10.2018 в 23:36
source

1 answer

0

<script src="https://unpkg.com/moment" />
<script>
moment.now() > moment(2016-11-23); //Regresa un boolean
</script> 

I recommend you use moment. you pass as a parameter the date you want to compare. I pass the documentation link: link

    
answered by 11.10.2018 / 23:45
source