Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda