Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 13, 2018 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/742f7e871cdc05507ae95c1546cce3c3 to your computer and use it in GitHub Desktop.
Save parzibyte/742f7e871cdc05507ae95c1546cce3c3 to your computer and use it in GitHub Desktop.
angular
.module("tuApp")
.filter("fechaExpresiva", function () {
return function (fecha) {
if (!fecha) return "";
fecha = new Date(fecha);
return ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"][fecha.getDay()] + ", " + fecha.getDate().toString() + " de " + ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"][fecha.getMonth()] + " de " + fecha.getFullYear().toString() + " " + (fecha.getHours() > 9 ? fecha.getHours() : "0" + fecha.getHours()).toString() + ":" + (fecha.getMinutes() > 9 ? fecha.getMinutes() : "0" + fecha.getMinutes()).toString();
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment