I am trying to convert a date with the format 1-Ene-2017
and successively with every month, to the format 01-01-2017
.
I get this date from a field called hidFechaFinal
with the following code:
function validaFechasAsignacion(){
var fecha_f = document.getElementById("hidFechaFinal").value;
if(typeof fecha_f === 'undefined' || fecha_f == null || fecha_f == ""){
alert("Seleccione la fecha final.");
return false;
}
var fechaFinal = new Date(fecha_f); //AQUI HAGO LA CONVERSION DE LA FECHA
alert("Fecha Final: " + fechaFinal); //AQUI IMPRIME InvalidDate
}
When I execute this function the alert
shows the message:
Final Date: InvalidDate
I suspect it's because the month is abbreviated in Spanish.