aboutsummaryrefslogtreecommitdiff
path: root/lib/date.js
diff options
context:
space:
mode:
authorTobias Witt <[email protected]>2016-03-02 15:21:54 +0100
committerMarak <[email protected]>2016-03-03 04:30:38 -0500
commit90a6a04f9cd4a134fec20949e68beb4baf79bfae (patch)
tree70ada7191ace4c22e7d6a5ffa4a65a92d65c92a9 /lib/date.js
parent9bb2b7c341bcf41e00341c92a8a66620c401c85f (diff)
downloadfaker-90a6a04f9cd4a134fec20949e68beb4baf79bfae.tar.xz
faker-90a6a04f9cd4a134fec20949e68beb4baf79bfae.zip
Install jsdoc and add doclet stubs for all methods
Descriptions are taken from existing comments if available. The address module already has some new sample descriptions.
Diffstat (limited to 'lib/date.js')
-rw-r--r--lib/date.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/date.js b/lib/date.js
index 2c53a4e4..e1ce7a48 100644
--- a/lib/date.js
+++ b/lib/date.js
@@ -1,5 +1,16 @@
+/**
+ *
+ * @namespace faker.date
+ */
var _Date = function (faker) {
var self = this;
+ /**
+ * past
+ *
+ * @method faker.date.past
+ * @param {number} years
+ * @param {date} refDate
+ */
self.past = function (years, refDate) {
var date = (refDate) ? new Date(Date.parse(refDate)) : new Date();
var range = {
@@ -14,6 +25,13 @@ var _Date = function (faker) {
return date;
};
+ /**
+ * future
+ *
+ * @method faker.date.future
+ * @param {number} years
+ * @param {date} refDate
+ */
self.future = function (years, refDate) {
var date = (refDate) ? new Date(Date.parse(refDate)) : new Date();
var range = {
@@ -28,6 +46,13 @@ var _Date = function (faker) {
return date;
};
+ /**
+ * between
+ *
+ * @method faker.date.between
+ * @param {date} from
+ * @param {date} to
+ */
self.between = function (from, to) {
var fromMilli = Date.parse(from);
var dateOffset = faker.random.number(Date.parse(to) - fromMilli);
@@ -37,6 +62,12 @@ var _Date = function (faker) {
return newDate;
};
+ /**
+ * recent
+ *
+ * @method faker.date.recent
+ * @param {number} days
+ */
self.recent = function (days) {
var date = new Date();
var range = {
@@ -51,6 +82,12 @@ var _Date = function (faker) {
return date;
};
+ /**
+ * month
+ *
+ * @method faker.date.month
+ * @param {object} options
+ */
self.month = function (options) {
options = options || {};
@@ -67,6 +104,12 @@ var _Date = function (faker) {
return faker.random.arrayElement(source);
};
+ /**
+ * weekday
+ *
+ * @param {object} options
+ * @method faker.date.weekday
+ */
self.weekday = function (options) {
options = options || {};