From 2258e1bdb71f8e7ba4ca322ca4a112534e99f262 Mon Sep 17 00:00:00 2001 From: Craig Cook Date: Thu, 3 Oct 2013 12:09:39 +0100 Subject: [PATCH] Testing #getDateString --- lib/objectutils.js | 5 ++--- test/ObjectUtilsSpec.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/objectutils.js b/lib/objectutils.js index fda306a..dd1a657 100644 --- a/lib/objectutils.js +++ b/lib/objectutils.js @@ -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(); diff --git a/test/ObjectUtilsSpec.js b/test/ObjectUtilsSpec.js index f5d283c..65c3f85 100644 --- a/test/ObjectUtilsSpec.js +++ b/test/ObjectUtilsSpec.js @@ -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; + // }); + }); });