Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var date = moment();
if(!schema.start) {
schema.start = start
}
if(!schema.end) {
schema.end = date
}
var someDate = gen.faker.date.between(schema.start, schema.end);
//ex. "2016-01-19T13:48:08.426-07:00"
return moment(someDate).format(dateFormat);
});
jsf.formats('utcBetween', function(gen, schema){
var start = moment(0); //01 January, 1970 UTC
var date = moment();
if(!schema.start) {
schema.start = start
}
if(!schema.end) {
schema.end = date
}
var someDate = gen.faker.date.between(schema.start, schema.end);
//ex. "2016-01-19T20:48:08.426Z" , compare to isoBetween, same dates
return moment(someDate).toISOString();
});
'use strict';
var jsf = require('json-schema-faker');
var moment = require('moment');
var dateFormat = require('./elastic_utils').dateFormat;
jsf.formats('isoBetween', function(gen, schema){
var start = moment(0); //01 January, 1970 UTC
var date = moment();
if(!schema.start) {
schema.start = start
}
if(!schema.end) {
schema.end = date
}
var someDate = gen.faker.date.between(schema.start, schema.end);
//ex. "2016-01-19T13:48:08.426-07:00"
return moment(someDate).format(dateFormat);
});
var date = moment();
if(!schema.start) {
schema.start = start
}
if(!schema.end) {
schema.end = date
}
var someDate = gen.faker.date.between(schema.start, schema.end);
//ex. "2016-01-19T20:48:08.426Z" , compare to isoBetween, same dates
return moment(someDate).toISOString();
});
jsf.formats('utcDate', function(gen, schema){
return new Date().toISOString()
});
jsf.formats('dateNow', function(gen, schema){
return moment().format(dateFormat);
});
module.exports = {
type: 'object',
properties: {
ip: {
"type": "string",
"faker": "internet.ip"
},
userAgent: {
type: 'string',
}
if(!schema.end) {
schema.end = date
}
var someDate = gen.faker.date.between(schema.start, schema.end);
//ex. "2016-01-19T20:48:08.426Z" , compare to isoBetween, same dates
return moment(someDate).toISOString();
});
jsf.formats('utcDate', function(gen, schema){
return new Date().toISOString()
});
jsf.formats('dateNow', function(gen, schema){
return moment().format(dateFormat);
});
module.exports = {
type: 'object',
properties: {
ip: {
"type": "string",
"faker": "internet.ip"
},
userAgent: {
type: 'string',
'faker': 'internet.userAgent'
},
url: {
type: 'string',