Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 16, 2022 00:43
Show Gist options
  • Save parzibyte/5966f6087d5d9a70ac5dc9e270e03d6a to your computer and use it in GitHub Desktop.
Save parzibyte/5966f6087d5d9a70ac5dc9e270e03d6a 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-12-31T00:00:00");
const UN_DIA_EN_MILISEGUNDOS = 1000 * 60 * 60 * 24;
const INTERVALO = UN_DIA_EN_MILISEGUNDOS * 7; // Cada semana
const formateadorFecha = new Intl.DateTimeFormat('es-MX', { dateStyle: '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