0
I’m calling a method to convert my ajax request to a readable date, but I keep getting the message that the function has not been set, I don’t understand why, since it is literally the function just above the one you are using
//converte o valor recebido em um objeto do tipo date em js
convertToJavaScriptDate: function (value) {
    var pattern = /Date\(([^)]+)\)/;
    var results = pattern.exec(value);
    var dt = new Date(parseFloat(results[1]));
    return dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear();
},
CarregaInfoComplementares: function (id, obj) {
    var Id = id;
    var tr = obj;
    $('.selectedRow').removeClass('selectedRow');
    $(obj).closest('tr').children().each(function () {
        $(this).addClass('selectedRow');
    });
    dados_entrada = "{'Id':'" + Id + "'}"
    $.ajax({
        type: "POST",
        url: "Pacote.aspx/CarregaInfoComplementares",
        data: dados_entrada,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        beforeSend: function () {
        },
        success: function (data, msg) {
            var row = $.parseJSON(data.d).dt[0];
            var datInicioValidade = convertToJavaScriptDate(row['DAT_INICIO_VALIDADE']);
            //mais codigo
       },
    });
},
I get the following error in the browser console: Uncaught Referenceerror: convertToJavaScriptDate is not defined
Thanks! I didn’t know I needed to say the name of the object being that it was already inside itself...
– Vitor Ceolin