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

224
Visualizações
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 Respostas
Responde à pergunta

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 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