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

133
Views
Is there an equivalent to moment timezone with a Javascript date?

I have this method below that takes in a Javascript date and then has to use Moment js to do its timezone conversion.

QUESTION - Is there a way to accomplish this without moment, just using a JS Date?

// ex. (someDate, 'America/Los_Angeles', 'MMM DD @ h:mm A z')

transform(dateUtc: Date, timeZone: string, momentFormat: string): string {
  const tempDateUtc = moment(dateUtc).utc(true);
  tempDateUtc.tz(timeZone);
  return tempDateUtc.format(momentFormat);
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To apply specific date formatting, rather than a locale based format, then no, not really, but it is possible to get the localized date parts to create a custom format.

As @RobG mentioned, you can use the Intl.DateTimeFormat to create a formatter. You build your options, including your timezone, and then use it's formatToParts(date) method to get the parts you need to construct your output.

Of course, this only works well if your Date is constructed using an epoch or UTC value.

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!