Skip to content
This repository has been archived by the owner on Aug 8, 2019. It is now read-only.

Commit

Permalink
Added %n for Date.format + Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Henning Bopp committed Feb 5, 2017
1 parent f872370 commit 9ceefc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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
5 changes: 4 additions & 1 deletion Specs/Types/Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,12 @@ describe('Date', function(){
it('should return the month number as two digits', function(){
expect(d.format('%m')).toEqual('11');
});
it('should return the minutes as two digits', 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('2');
});
it('should return the ordinal, and should be the same as .getOridnal', function(){
expect(d.format('%o')).toEqual(d.get('ordinal'));
});
Expand Down

0 comments on commit 9ceefc6

Please sign in to comment.