Skip to content

Instantly share code, notes, and snippets.

@LucasGorgal
Last active September 3, 2021 17:35
Show Gist options
  • Save LucasGorgal/08cfd53cd4a0b3e701c767bf4d8032fc to your computer and use it in GitHub Desktop.
Save LucasGorgal/08cfd53cd4a0b3e701c767bf4d8032fc to your computer and use it in GitHub Desktop.
Redirecionador temporal
date = new Date();
let timeSaoPaulo = date.toLocaleString('pt-BR', {timeZone: 'America/Sao_Paulo'});
let meAvisaURL = 'https://metodoreorganize.com.br/meavisa';
let matriculaURL = 'https://metodoreorganize.com.br/matricula-teste';
if(timeSaoPaulo <= "02/09/2021 20:00:00") { //Redireciona para o /meavisa até dia 02/09 às 20h
window.location.replace(meAvisaURL);
} else if(timeSaoPaulo > "02/09/2021 20:00:00" || timeSaoPaulo <= "11/09/2021 00:00:00") { //Redireciona para /matricula entre 02/09 de 20h até 11/09 até 00h
window.location.replace(matriculaURL);
} else { //Depois redireciona para /meavisa
window.location.replace(meAvisaURL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment