moment js UTC to local code example
Example 1: moment js convert to local timezone
const time = moment.tz("2021-04-14T02:08:10.370Z")
const localtz = moment.tz.guess()
const date = time.clone().tz(localtz)
const formatDate = moment(date).format('MMMM Do YYYY, h:mm:ss A z')
Example 2: convert utc time to local time moment
const date = moment.utc().format();
console.log(date, "- now in UTC");
const local = moment.utc(date).local().format();
console.log(local, "- UTC now to local");
Example 3: moment time format by country
import moment, { Moment } from 'moment'
moment(new Date(), moment.locale('id')).format('llll')