Installment js

0

Well, I've created an account installment system ... I'd like to know how to filter ...

[{"tipo":0,"classe":"Saída","nome":"a 1/2","tag":"a","categoria":"Carro","cor":"SkyBlue","data":"2-2016","pg":"1"},{"tipo":0,"classe":"Saída","nome":"a 2/2","tag":"a","categoria":"Carro","cor":"SkyBlue","data":"3-2016","pg":"0"},{"tipo":0,"classe":"Saída","nome":"a2 1/3","tag":"a2","categoria":"Carro","cor":"SkyBlue","data":"2-2016","pg":"0"},{"tipo":0,"classe":"Saída","nome":"a2 2/3","tag":"a2","categoria":"Carro","cor":"SkyBlue","data":"3-2016","pg":"0"},{"tipo":0,"classe":"Saída","nome":"a2 3/3","tag":"a2","categoria":"Carro","cor":"SkyBlue","data":"4-2016","pg":"0"}]

this and the table with all the installments that are registered at the moment ...

for example. we are in the month 4-2016 filter the arrears and the current month only ... and put a delayed notice on the delayed accounts

    
asked by anonymous 13.02.2016 / 07:02

1 answer

1
function checarDatas(data_parcelamento,data_final) {
    var data_1 = new Date(data_parcelamento);
    var data_2 = new Date(data_final);
    if (data_1 < data_2) {
        console.log('atrasada');
    } else if (data_1 > data_2) {
        console.log('adiantada');
    } else {
        console.log('do mes');
    }
}

I got this way: D

    
13.02.2016 / 08:54