-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically augment availableFormats #462
Conversation
Dynamically augment availableFormats Fixes globalizejs#271
Awesome! All I see for now are some style issues, which I'm going to comment inline. |
@@ -7,3 +7,4 @@ before_install: | |||
install: | |||
- npm install | |||
- bower install | |||
sudo: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @jzaefferer @scottgonzalez to comment on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as its in a separate commit. Should also enable caching, see, for example, qunitjs/qunit#835
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vectart please could you include this? ☝️
Migrate to container-based infrastructure http://docs.travis-ci.com/user/migrating-from-legacy/
@@ -38,6 +39,89 @@ return function( options, cldr ) { | |||
); | |||
} | |||
|
|||
function getBestMatchPattern( path, skeleton ) { | |||
var availableFormats, ratedFormats, format; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you want to define pattern
as a variable local to this function, so it's not mixed up with pattern
defined by the parent function.
@vectart I left a couple of comments, please just let me know on any questions and thanks so far. |
@rxaviers Thanks for the useful comments, I've updated PR according to them |
Please, could you rebase on master ( |
maxLength = Math.max( formatA.length, formatB.length ); | ||
minLength = Math.min( formatA.length, formatB.length ); | ||
|
||
for ( index = 0; index < minLength; index++ ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok using i
instead of index
here. :)
Interestingly, the augmentation for |
Another worth doing test is checking against ICU... One difference I found is: |
timeSkeleton = getBestMatchPattern( | ||
"dates/calendars/gregorian/dateTimeFormats/availableFormats", | ||
timeSkeleton | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need use getBestMatchPattern()
for each date and time before the type
assignment above. For example, MMMMh
should give July, 8 PM
(type medium) instead of July at 8 PM
(type long). Because, "MMMM" will be converted into "LLLL".
@vectart just let me know when you have progress, so we can land this fix. Thanks for your great work so far. |
reimplements globalizejs#462
How about to use builtin |
fixes #271