I have a UTC timestamp coming down from the server side. It's a static timestamp (for example: 11:30) I want to convert 11:30 to users local timezone.
I did this:
const SessionStartTime = () => {
const startTime = moment.sessionStartTime
const convertTime = moment.utc(startTime).toDate()
const localTime = moment(convertTime)
console.log(localTime)
return <span>{new Date(startTime)}</span>
}
which converts the time to clients REAL-TIME which is not what I'm looking for. Any tips? edit:
After reading the docs I came up with this
const SessionStartTime = () => {
const dateFormat = "HH:mm"
const startTime = sessionStartTime
const localTime = startTime.local()
return <span>{localTime.format(dateFormat)}</span>
}
but it doesn't do anything.