Skip to content
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

Add unit formatting module #512

Closed
wants to merge 20 commits into from
Closed

Conversation

alunny
Copy link
Collaborator

@alunny alunny commented Sep 24, 2015

This is picking up @rxaviers's patch in #254 to solve #252.

@alunny
Copy link
Collaborator Author

alunny commented Sep 25, 2015

I think I can make it work by heavily cargo-culting relative-timestamp - new patch forthcoming.

@alunny
Copy link
Collaborator Author

alunny commented Sep 25, 2015

(I have spaces instead of tabs in many places - will update that when this is good to merge otherwise)

*
* Format units such as seconds, minutes, days, weeks, etc.
*/
Globalize.prototype.formatUnit = function( value, unit, options ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this according to the below please. So, it's accessible via both static function (Globalize.formatUnit) and instance method (new Globalize(locale).formatUnit)

Globalize.formatUnit =
Globalize.prototype.formatUnit = function( ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed on my local branch (commenting for my own tracking benefit)

return Globalize;

});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space vs tabs indentation is still used here. Tabs should be used for indentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra empty line in the bottom of the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why grunt jscs:source didn't caught these...

@rxaviers
Copy link
Member

rxaviers commented Oct 1, 2015

Great work so far!! I have left a couple of comments above. Other than that, I also miss these points:

  • Update docs (refs 1, 2, 3);
  • Build unit module (refs 1, 2);
  • Create functional tests (ref 1);
  • Build runtime module (refs 1, 2)

Just let me know on any questions and thanks for the great work!

@alunny
Copy link
Collaborator Author

alunny commented Oct 8, 2015

Thanks for the great feedback - working on cleaning up this branch now :)

*
* Return all unit categories.
*/
return [ "acceleration", "angle", "area", "digital", "duration", "length", "mass", "power",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in exactly one place, does that really justify a separate file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it helps to make the build easier. This could change though when the source code uses ES6.

util.assertParameterPresence( assert, "options", function( ) {
Globalize.formatUnit( 1, "day" );
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually options should be optional. 😝

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on it.

rxaviers added a commit that referenced this pull request Oct 20, 2015
rxaviers pushed a commit that referenced this pull request Oct 20, 2015
@rxaviers rxaviers closed this in 15a9dd2 Oct 20, 2015
@rxaviers
Copy link
Member

Awesome! Rebased and merged. Thx @alunny

@rxaviers
Copy link
Member

Published in 1.1.0-rc.4

@alunny
Copy link
Collaborator Author

alunny commented Oct 20, 2015

Great, thanks @rxaviers!

@jzaefferer
Copy link
Contributor

👏 👏 👏

rxaviers added a commit that referenced this pull request Oct 21, 2015
rxaviers added a commit that referenced this pull request Oct 21, 2015
rxaviers added a commit that referenced this pull request Oct 21, 2015
rxaviers added a commit that referenced this pull request Oct 21, 2015
rxaviers added a commit that referenced this pull request Oct 21, 2015
rxaviers added a commit that referenced this pull request Feb 4, 2016
rxaviers added a commit that referenced this pull request Feb 4, 2016
rxaviers added a commit that referenced this pull request Feb 4, 2016
rxaviers pushed a commit that referenced this pull request Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants