I have a timestamp, which I'm formatting with momentjs:
moment("2015-03-24T09:47:31.042Z").format("LLL Z")
"March 24, 2015 10:47 AM +01:00"
Due to the nature of our application, we're setting a default timezone for momentjs, which affects all rendered moments:
moment.tz.setDefault("America/Los_Angeles")
moment("2015-03-24T09:47:31.042Z").format("LLL Z")
"March 24, 2015 2:47 AM -07:00"
So far, so great. But now I want to display the local time in one specific spot in the application, but momentjs will of course use the provided default timezone:
moment().format("LLL Z")
"March 24, 2015 2:52 AM -07:00"
How can I construct a moment instance that uses the local timezone again?
I tried using moment.tz(timestamp,null)
, but that simply uses GMT.