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
Maybe I am missing it, but I don't see a way to get the Localized DateTime Format based on the Time Zone.
Having:
var testDate = new Date(Date.UTC( 2014, 2, 21, 0, 0, 0 ));
formatDate( testDate, { datetime: "medium" });
and for 2 different Time Zones get a different Output:
A) for Time Zone: America/Los_Angeles get:
Mar 20, 2014, 5:00:00 PM
B) for America/Mexico_City get:
Mar 20, 2014, 7:00:00 PM
I didn't see a way to pass the TZ, but maybe I am missing it.
thanks
Globalize doesn't try to overcome any native JavaScript timezone limitations (more info at #202). Therefore, our current timezone support provides simple coverage (you can't set an arbitrary timezone and we skip some formatting patterns). We keep the enhanced date timezone module open on #340, which will rely on a third-party library that supports Olson timezones and advanced manipulations.
Having said that, there are fields for formatting the local timezone, which are z..zzz, Z..ZZZZZ, O,OOOO, x..xxxxx, and X..XXXXX (more info at http://www.unicode.org/reports/tr35/tr35-dates.html), or by using time (or datetime) long or full. For example:
Globalize("en").formatDate(newDate(),{time:"long"});// > '10:04:55 AM GMT-3'Globalize("en").formatDate(newDate(),{datetime:"long"});// > 'June 18, 2015 at 10:05:11 AM GMT-3'Globalize("en").formatDate(newDate(),{raw: "OOOO"});// > 'GMT-03:00'Globalize("en").formatDate(newDate(),{raw: "z"});// > 'GMT-3'Globalize("en").formatDate(newDate(),{raw: "Z"});// > '-0300'
Please, let me know on any questions.
I'm leaving this bug opened until we improve the timezone explanations on /doc/api/date/date-formatter.md. Would you be interested in helping out? Thanks.
Improve timezone explanation on /doc/api/date/date-formatter.md.
Maybe I am missing it, but I don't see a way to get the Localized DateTime Format based on the Time Zone.
Having:
var testDate = new Date(Date.UTC( 2014, 2, 21, 0, 0, 0 ));
formatDate( testDate, { datetime: "medium" });
and for 2 different Time Zones get a different Output:
A) for Time Zone: America/Los_Angeles get:
Mar 20, 2014, 5:00:00 PM
B) for America/Mexico_City get:
Mar 20, 2014, 7:00:00 PM
I didn't see a way to pass the TZ, but maybe I am missing it.
thanks
@rxaviers
The text was updated successfully, but these errors were encountered: