Globalization API - Sample Use Cases
ecmascript at norbertlindenberg.com
Mon Jan 16 18:35:02 PST 2012
I don't think a standalone pattern string is sufficient - the pattern doesn't encode all information that the DateTimeFormat needs. In this version of the API, we need at least the timeZone option, in a later version probably also a calendar option.
On Dec 6, 2011, at 11:42 , Nicholas C. Zakas wrote:
> On 12/2/2011 1:35 PM, Nebojša Ćirić wrote:
>> The easy solution to that is to add 2 more fields to the options (or have them as separate parameter):
>> 1. pattern - as is, I know what I want - MM/yy always generates 9/74 no matter the locale.
>> 2. skeleton - MM/yy will get you closest matching pattern for a given locale.
>> If pattern or skeleton fields are specified, we ignore the rest of the options object.
>> We had this approach before and removed it from the spec to simplify the API, but it shouldn't be hard to get it back in.
> I like it. I'd even go one step further to suggest that the first argument be allowed as either a string or an object. If a string, then treat as a pattern, otherwise, treat as an options object.
More information about the es-discuss