Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 27, 2023 17:46
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/0a953a8fe02c485365a1de50ec1bf643 to your computer and use it in GitHub Desktop.
Save parzibyte/0a953a8fe02c485365a1de50ec1bf643 to your computer and use it in GitHub Desktop.
const formateadorFechasRelativas = new Intl.RelativeTimeFormat('en-US', { style: 'long', });
const lanzamientoRE4 = new Date("2023-03-24T00:00:00");
const ahora = new Date();
const diferenciaEnMilisegundos = lanzamientoRE4.getTime() - ahora.getTime();
const diferenciaEnDias = diferenciaEnMilisegundos/1000/60/60/24;
formateadorFechasRelativas.format(diferenciaEnDias, 'day');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment