Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!