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

144
Views
How to get the next Sunday in a user's timezone using moment timezone?

I know that a user is available on the next Sunday in timezone America/New_York at 13:00. How can I get the date (in format January 12, 2022 9:00 am) of the next Sunday in that timezone and then convert that to a user's current timezone (i.e. America/Los_Angeles) using moment.timezone library?

I know how to do this using utc, but not with timezones involved.

function nextWeekdayDate(date, day_in_week) {
  var ret = new Date(date||new Date());
  ret.setDate(ret.getDate() + (day_in_week - 1 - ret.getDay() + 7) % 7 + 1);
  return ret;
}
 
var date = new Date();
console.log(nextWeekdayDate(date, 5));
about 4 years ago · Juan Pablo Isaza
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!