Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
JavaScript's time zones as a way to locate a user's country

I need to determine a user's country, and it doesn't need to be super accurate (getting it right 90% of the time is probably enough). I realized the time zone returned by JavaScript could work.

Example:

console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);

Will return America/Toronto or America/New_York, which can help me differentiate a Canadian from an American.

Sure I understand this is based on the user’s preferences, not its real location. But is there a huge pitfall I'm not seeing right now using this technic?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After some research, turns out it depends on the scenario (was predictable). For my scenarios, American get the right Timezone 95%+ of the time, while Canadian get it 90%+.

The way to test this out was to save the user's JS timezone in our Google Analytics, and then compare it to their location.

So your mileage may vary, but for my use case, this was more than enough.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda