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

223
Vistas
Moment Setup Timezone not working still getting local date time

I'm trying to setup a default timezone for moment js

I already imported moment-timezone and use this code

var moment = require('moment-timezone');
moment.tz.setDefault('Asia/Taipei');
console.log(moment().format('YYYY-MM-DD'));

but when I change my local date in my laptop to April 22, 2022.

Which is April 21,2022 in taipei right now, the console log give me this

2022-04-22

can you help me set up moment timezone not by my local time but depending on the timezone declared

sorry for my poor english

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The momentjs is working as it should. MomentJs basically gets the current time from computer and then formats it using the timezone you want. For example If you set your timezone to another country say India then the time in the console will be 2:30 extra. I hope you got it.

If you want time independent of User's Device then you should use Time Apis like https://worldtimeapi.org/api/timezone/Asia/Taipei and make ajax calls to update your time. Like i integrated on the link

Hope it helps.

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