Initial commit of datetime generator

This commit is contained in:
pyoor 2017-06-26 14:43:25 -04:00
parent 3cda93c824
commit 02b8070dfa
1 changed files with 22 additions and 0 deletions

22
lib/make/datetime.js Normal file
View File

@ -0,0 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
make.datetime = {
object: function () {
switch (random.number(2)) {
case 0:
return new Date(new Date().getTime() + random.number())
case 1:
return new Date(new Date().getTime() - random.number())
}
},
date: function () { // eslint-disable-line no-unused-vars
return this.datetime.object().toDateString()
},
time: function () { // eslint-disable-line no-unused-vars
return this.datetime.object().toTimeString()
}
}