0

I have the following code

if (list.Date[0] != 'undefined') {
            for (var i in list) {
                var date = list[i].Data;
                var year = date.substr(0, 4);
                var month = date.substr(5, 2);
                var day = date.substr(8, 2);

                var newDate = day + "/" + month + "/" + year + " " + date.substr(11, 8);

                list[i].Date = newDate;
            }
        }

It's inside a validation code, that makes the validation of all the forms. Some has the field date and others don't. How can I do a validation if inside the array has the date field?

1
Contributor
1
Reply
5
Views
2 Years
Discussion Span
Last Post by jean_5
0
for (var i in list) {
    if('Data' in list[i])
    {
        var data = list[i].Data;
        var ano = data.substr(0, 4);
        var mes = data.substr(5, 2);
        var dia = data.substr(8, 2);

        var dataBr = dia + "/" + mes + "/" + ano + " " + data.substr(11, 8);

        list[i].Data = dataBr;
    }
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.