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

Fix bug 1342 #1348

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/Types/Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ Date.implement({
case 'L': return pad(d.get('ms'), 3);
case 'm': return pad((d.get('mo') + 1), 2);
case 'M': return pad(d.get('min'), 2);
case 'n': return (d.get('mo') + 1);
case 'o': return d.get('ordinal');
case 'p': return Date.getMsg(d.get('ampm'));
case 's': return Math.round(d / 1000);
Expand Down
3 changes: 3 additions & 0 deletions Specs/Types/Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ describe('Date', function(){
it('should return the minutes as two digits', function(){
expect(d.format('%M')).toEqual('02');
});
it('should return the month as one digit', function(){
expect(d.format('%n')).toEqual('11');
Copy link

Choose a reason for hiding this comment

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

This test is not really suitable to test %n, is it? You should pick a month < 10 and make sure there is no leading 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should get some more coffee before my first commits on sundays... ;-)
Thx. Fixed.

});
it('should return the ordinal, and should be the same as .getOridnal', function(){
expect(d.format('%o')).toEqual(d.get('ordinal'));
});
Expand Down