I have been trying to format the date (OffsetDateTime) received from backend and convert the same in local time zone using moment.
I have imported the library.
import moment from "moment-timezone/builds/moment-timezone-with-data";
To format the date, I have used -
moment("2020-04-21T06:02:06.059934-05:00").format(
"YYYY-MM-DD HH:mm:ss z"
)
The output received is - 2020-04-21 06:02:06. The timezone is not displayed.
However if I use -
moment("2020-04-21T06:02:06.059934-05:00").format(
"YYYY-MM-DD HH:mm:ss ZZ"
)
The output received is - 2020-04-21 06:02:06 -0500.
How do I display the timezone in CST or IST or any local browser timezone?