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

177
Vistas
Detecting if the system time doesn't correspond to system timezone [Javascript]

I have a particular system configuration where my timezone is setted at (UTC-03:00) but I configured the system time to an hour after (e.g: Originally my time using the timezone must be 14:41, but I updated to 15:41).

What I want to know if there is a way using any library to know that the time is not correlated with the timezone.

Other solution could be to resolve the time using moment or other library returning the time using the system timezone and not the system time.

I tired using Date or moment with moment-timezone with no luck.

E.g:

System Time: 15:46 (+1 Hour configured manually)

Timezone Time: 14:46 (This should be the hour if isn't updated)

moment()  //result Wed Nov 17 2021 15:46:19 GMT-0300

What I want is

moment().someFunc()  //result Wed Nov 17 2021 14:46:19 GMT-0300
// Could be a function, property, just a difference to use it in order 
//to compare with other date that comes from the server
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you try to get the utc date time (with moment().utc()) the result is your time less utcOffset and there isn't somthing about that in the documentation, so I think there isn't a way to do what do you want.

an alternative is to get the time from a external server like code bellow, but I hope for you that someone else know a way better

async function myTzTime() {
  const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
  const { data: { datetime } = {} } = await axios.get(`http://worldtimeapi.org/api/timezone/${timezone}`);
  

  console.log('--->', datetime)
}

myTzTime();
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.24.0/axios.min.js"></script>

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