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

229
Views
how to format birthday?

I'm having trouble formatting the birthday date in the format 2021-04-13T00:00:00.000Z the date is sent correctly, but after this formatting it always has 1 day less. Can anyone help?

export function format(date): string {
  const mydate = new Date(date);
  return new Intl.DateTimeFormat().format(mydate);
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using the basic Date methods .getUTCYear(), .getUTCMonth(), and .getUTCDay() will enable you to get the date as it appears in your UTC-relative source string. As noted in a comment, your apparent date when rendered in your local time zone is one day earlier, as is correct for time zones west of UTC.

You can still make use of Intl.DateTimeFormat() if you pass in an option to use UTC as the time zone:

return new Intl.DateTimeFormat("pt-BR", { timeZone: "UTC" }).format(dateInput);

However, that's not supported by IE11 (if that's important to you).

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!