Convert 2020-10-18T21:00:00.000-03:00 to 2020-10-19T00:00

81 Views Asked by At

As you can see in the image, I'm getting an array of dates from my API, which I need to show on the frontend, but in my actual timezone, which is America/Sao_Paulo. The problem is, I can't figure out how to do this using date-fns and date-fns-tz. I've had some tries, but with no success.

Example:

From

2020-10-18T21:00:00.000-03:00

To

2020-10-19T00:00

API response

Some code I wrote, but didn't work:

    const lastParsedDate = parseISO(dates[dates.length - 1])

    const tzTime = utcToZonedTime(lastParsedDate, 'America/Sao_Paulo')

    console.log(lastParsedDate, tzTime)
0

There are 0 best solutions below