Search code examples
javascriptdatemomentjsisoluxon

Luxon date formatting from object as moment does


How can I pass a string object inside a Luxon hours formatting?

var message = "2020-10-05 17:24:23.456354"

Kind of a: {DateTime(message).local().toFormat("HH:mm")}

Which is not working.

In moment.js would be: {moment(message).format("HH:mm")}


Solution

  • {DateTime.fromISO(message).toFormat("HH:mm")}