-
Notifications
You must be signed in to change notification settings - Fork 215
Switch to using the raw CLDR data #77
Comments
/cc @ericf |
I have done a lot of experimentation on this regards, the problem is that the amount of data will also increase drastically if we add all CLDR data, I'm looking at: "timeFormats": {
"full": "h:mm:ss a zzzz",
"long": "h:mm:ss a z",
"medium": "h:mm:ss a",
"short": "h:mm a"
},
"dateTimeFormats": {
"full": "{1} 'at' {0}",
"long": "{1} 'at' {0}",
"medium": "{1}, {0}",
"short": "{1}, {0}",
"availableFormats": {
"E": "ccc",
"EHm": "E HH:mm",
"EHms": "E HH:mm:ss",
"Ed": "d E",
"Ehm": "E h:mm a",
"Ehms": "E h:mm:ss a",
"Gy": "y G",
"GyMMM": "MMM y G",
"GyMMMEd": "E, MMM d, y G",
"GyMMMd": "MMM d, y G",
"H": "HH",
"Hm": "HH:mm",
"Hms": "HH:mm:ss",
"M": "L",
"MEd": "E, M/d",
"MMM": "LLL",
"MMMEd": "E, MMM d",
"MMMd": "MMM d",
"Md": "M/d",
"d": "d",
"h": "h a",
"hm": "h:mm a",
"hms": "h:mm:ss a",
"ms": "mm:ss",
"y": "y",
"yM": "M/y",
"yMEd": "E, M/d/y",
"yMMM": "MMM y",
"yMMMEd": "E, MMM d, y",
"yMMMd": "MMM d, y",
"yMd": "M/d/y",
"yQQQ": "QQQ y",
"yQQQQ": "QQQQ y"
}
} although, I will say that this is not more than: "formats": [
{
"weekday": "long",
"month": "long",
"day": "numeric",
"year": "numeric",
"hour": "numeric",
"minute": "2-digit",
"second": "2-digit",
"pattern": "{weekday}, {month} {day}, {year}, {hour}:{minute}:{second}",
"pattern12": "{weekday}, {month} {day}, {year}, {hour}:{minute}:{second} {ampm}"
},
{
"weekday": "long",
"month": "short",
"day": "numeric",
"year": "numeric",
"hour": "numeric",
"minute": "2-digit",
"second": "2-digit",
"pattern": "{weekday}, {month} {day}, {year}, {hour}:{minute}:{second}",
"pattern12": "{weekday}, {month} {day}, {year}, {hour}:{minute}:{second} {ampm}"
},
{
"weekday": "long",
"month": "long",
"day": "numeric",
"year": "numeric",
"pattern": "{weekday}, {month} {day}, {year}"
},
{
"weekday": "long",
"month": "short",
"day": "numeric",
"year": "numeric",
"pattern": "{weekday}, {month} {day}, {year}"
},
{
"month": "long",
"day": "numeric",
"year": "numeric",
"pattern": "{month} {day}, {year}"
},
{
"month": "numeric",
"day": "numeric",
"year": "numeric",
"pattern": "{month}/{day}/{year}"
},
{
"month": "short",
"day": "numeric",
"year": "numeric",
"pattern": "{month} {day}, {year}"
},
{
"month": "numeric",
"year": "numeric",
"pattern": "{month}/{year}"
},
{
"month": "long",
"year": "numeric",
"pattern": "{month} {year}"
},
{
"month": "short",
"year": "numeric",
"pattern": "{month} {year}"
},
{
"month": "long",
"day": "numeric",
"pattern": "{month} {day}"
},
{
"month": "short",
"day": "numeric",
"pattern": "{month} {day}"
},
{
"month": "numeric",
"day": "numeric",
"pattern": "{month}/{day}"
},
{
"hour": "numeric",
"minute": "2-digit",
"second": "2-digit",
"pattern": "{hour}:{minute}:{second}",
"pattern12": "{hour}:{minute}:{second} {ampm}"
},
{
"hour": "numeric",
"minute": "2-digit",
"pattern": "{hour}:{minute}",
"pattern12": "{hour}:{minute} {ampm}"
}
], but it will require more computations during runtime, not that I'm worry about it, since this is a polyfill for older browsers :), what do you think about this @andyearnshaw and @ericf ? |
And Node.js, where the problem is exacerbated with many connections to a server. |
Indeed, that was the reason for the custom data format in the first place I think the payoff would probably be worth it though, it seems to be every
|
Ok, I finally get a chance to implement this here: 869782c |
this is now part of 1.0.0-rc-1 |
In a rather short-sighted attempt at boosting the performance of the library, I wrote a small script to compile CLDR data into the format used by the ECMA-402 spec. I see the mistake now, as it's become difficult to include all the date patterns for each locale without bulking up the data tremendously.
We should use the raw CLDR formats for the best chance at matching the output from native versions of the Intl APIs.
The text was updated successfully, but these errors were encountered: