JSFiddle - React, Tailwind, and code Playground

JavaScript

function gerarData(str) {
    var partes = str.split("/");
    return +new Date(partes[2], partes[1] - 1, partes[0]);
}

function teste(data_1, data_2) {
    var a = gerarData(data_1);
    var b = gerarData(data_2);
    
    var tipo;
    if (a < b) tipo = 'anterior';
    else if (a == b) tipo = 'igual';
    else if (a > b) tipo = 'posterior';
    else tipo = 'inconclusivo'
    return tipo;
}

var testeA = teste('03/03/2016', '03/03/2016');
var testeB = teste('03/05/2016', '03/03/2016');
var testeC = teste('03/01/2016', '03/03/2016');
var testeD = teste('03/03/2016', 'xxxxxxxxxx');
console.log(testeA, testeB, testeC, testeD)