Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 16, 2022 00:48
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/633dea16ac46c030263704967a95dd3f to your computer and use it in GitHub Desktop.
Save parzibyte/633dea16ac46c030263704967a95dd3f to your computer and use it in GitHub Desktop.
// https://parzibyte.me/blog
const inicio = new Date("2021-01-01T00:00:00");
const fin = new Date("2021-01-02T00:00:00");
const UN_MINUTO_EN_MILISEGUNDOS = 1000 * 60;
const INTERVALO = UN_MINUTO_EN_MILISEGUNDOS * 45;
const formateadorFecha = new Intl.DateTimeFormat('es-MX', { dateStyle: 'medium', timeStyle: "medium" });
for (let i = inicio; i <= fin; i = new Date(i.getTime() + INTERVALO)) {
console.log(formateadorFecha.format(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment