Skip to content

Commit

Permalink
Testing #getDateString
Browse files Browse the repository at this point in the history
  • Loading branch information
BoyCook committed Oct 3, 2013
1 parent 0e30f42 commit 2258e1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/objectutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ exports.isNotObject = isNotObject;
exports.isNumber = isNumber;
exports.isString = isString;

exports.getDateString = function() {
var date = Date.now();
exports.getDateString = function(date) {
return date.getFullYear() + '-' +
date.getMonth() + '-' +
(date.getMonth() + 1) + '-' +
date.getDate() + ' ' +
date.getHours() + ':' +
date.getMinutes();
Expand Down
12 changes: 12 additions & 0 deletions test/ObjectUtilsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,16 @@ describe('ObjectUtils', function () {
Object.isString(1).should.be.false;
});
});

describe('#getDateString', function () {
it('should give date at string', function () {
Object.getDateString(new Date('2013-10-01 15:00')).should.eql('2013-10-1 15:0');
});
// it('should think a string is a string', function () {
// Object.isString('').should.be.true;
// });
// it('should not think an int is an string', function () {
// Object.isString(1).should.be.false;
// });
});
});

0 comments on commit 2258e1b

Please sign in to comment.