You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to construct a moment from a date, time and timezone? For example how do I construct August 15, 2013, 1:00 PM in timezone = "America/Chicago"? I think [PR Alternative construct moment local to timezone #25] addresses this but I can't be sure.
How do I fomat such a moment back with a timezone abbreviation, for example "15 Aug 2013 01:00 PM CDT". I tried the following, but it prints the timezone as an offset.
moment("08/15/2013 1:00 PM -0500", "MM/DD/YYYY hh:mm A Z")
.tz('America/Chicago')
.format('DD MMM YYYY hh:mm A Z');
produces
15 Aug 2013 01:00 PM -05:00
Timezone is printed as offset, not as CDT
The text was updated successfully, but these errors were encountered:
#25 does handle the first part, as discussed in #11. Regarding abbreviations, we have an open item in #4.
However you should know that time zone abbreviations are not standardized worldwide, and there are many ambiguities. So if they are supported, it would be for display only. They would work with .format(), but would be ignored when parsing.
Currently you can use .zoneName() or .zoneAbbr() to pull out the abbreviation, but there is no specific format token yet.
z and zz have been added back into moment for formatting the timezone name and abbreviations. (although they do require moment-timezone or another library to override moment#zoneName and moment#zoneAbbr)
Two part question:
Is it possible to construct a moment from a date, time and timezone? For example how do I construct August 15, 2013, 1:00 PM in timezone = "America/Chicago"? I think [PR Alternative construct moment local to timezone #25] addresses this but I can't be sure.
How do I fomat such a moment back with a timezone abbreviation, for example "15 Aug 2013 01:00 PM CDT". I tried the following, but it prints the timezone as an offset.
moment("08/15/2013 1:00 PM -0500", "MM/DD/YYYY hh:mm A Z")
.tz('America/Chicago')
.format('DD MMM YYYY hh:mm A Z');
produces
Timezone is printed as offset, not as CDT
The text was updated successfully, but these errors were encountered: