0

I am trying to display a date like this, with current timezone

Jul 20, 2017 2:39pm EDT

What I manage to get is this

<Moment format="MMM DD, YYYY h:mma">{new Date()}</Moment>

Output: Jul 20, 2017 2:39pm

I also found this

<Moment>{new Date()}</Moment>

Output: Thu Jul 20 2017 15:16:50 GMT-0400

But I don't want all the extra stuff, I just to display timezone name.

userNotHere
  • 97
  • 1
  • 2
  • 11

1 Answers1

0

The general problem is that time zone abbreviations are not available from the browser through a consistent API. In order to provide them, one has to have an external source of data.

-There is also now built-in support for time zone detection/guessing in momentjs timezone:

var tzName = moment.tz.guess();
var abbr = m.tz(tzName).zoneAbbr();  // or .format('z')

More importantly, you can find other options in this post Get timezone abbreviation using offset value

Vipul Singh
  • 638
  • 3
  • 10