aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bergman <[email protected]>2014-07-22 16:11:34 -0400
committerMatthew Bergman <[email protected]>2014-07-22 16:11:34 -0400
commita4f7954e899dab13f73c14647d74a93ef7b6eb8f (patch)
tree898cd7cb44fcd42bc3bde0d71a964ce7e663fde0
parentdaa95b3a4f3eb5131970271be3820ddb45d30022 (diff)
parent8b894a08c89ae803bbd3c2a9721ff859fae13ea5 (diff)
downloadfaker-a4f7954e899dab13f73c14647d74a93ef7b6eb8f.tar.xz
faker-a4f7954e899dab13f73c14647d74a93ef7b6eb8f.zip
Merge pull request #89 from edshadi/fix-date-recent-bug
fixed date.recent() bug
-rw-r--r--lib/date.js2
-rw-r--r--test/date.unit.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/date.js b/lib/date.js
index 795e674e..23e0dc58 100644
--- a/lib/date.js
+++ b/lib/date.js
@@ -33,7 +33,7 @@ var date = {
recent: function (days) {
var date = new Date();
var future = date.getTime();
- future -= Faker.random.number(days) * 3600 * 1000; // some time from now to N days ago, in milliseconds
+ future -= Faker.random.number(days) * 24 * 60 * 60 * 1000; // some time from now to N days ago, in milliseconds
date.setTime(future)
return date.toJSON();
diff --git a/test/date.unit.js b/test/date.unit.js
index 83b73ca9..39f96a79 100644
--- a/test/date.unit.js
+++ b/test/date.unit.js
@@ -46,7 +46,7 @@ describe("date.js", function () {
var date = Faker.Date.recent(30);
- assert.ok(Date.parse(date) < new Date());
+ assert.ok(Date.parse(date) <= new Date());
});
});