Search code examples
javascriptangulardatetimeutcluxon

How do I convert and display a UTC DateTime to the browsers local time?


I need to show a UTC date time in the users browser as the users(browser) local time.

Ex. 04:52 UTC -> 09:52 PST (if browser/user is in Los Angeles)

as PST is -7 hours from UTC

I have no requirement, it can be done in Javascript, typescript, or using Luxon, which I currently use across my project.


Solution

  • I found the best solution for me using Angular. Just add the 'Z'

    {{(transfer.createdDate + 'Z' | date)}}

    link is here