Skip to content

Instantly share code, notes, and snippets.

@romaefGit
Created October 29, 2019 20:01
Show Gist options
  • Select an option

  • Save romaefGit/2a127c37a85de30203e08a454369429e to your computer and use it in GitHub Desktop.

Select an option

Save romaefGit/2a127c37a85de30203e08a454369429e to your computer and use it in GitHub Desktop.
JavaScript - desbarata fecha
/**
* Autor - Romario Estrada - romarioestrada.ff@hotmail.com
* [desbarataFecha recibe fecha en formato mes / dia / año -> 3/12/2017]
* @param {[String]} fecha [fecha]
* @return {[JSON]} [fecha partida en un JSON]
*/
var desbarataFecha = function(fecha) {
var respuesta = { day: null, month: null, year: null };
arrayFecha = fecha.split("/");
respuesta.day = parseInt(arrayFecha[1]);
respuesta.month = parseInt(arrayFecha[0]);
respuesta.year = parseInt(arrayFecha[2]);
return respuesta;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment