in external_lib/dummy-json/lib/helpers.js [55:85]
function getDate (type, min, max, format, options) {
var ret;
// Juggle the arguments if the user didn't supply a format string
if (!options) {
options = format;
format = null;
}
if (type === 'date') {
min = Date.parse(min);
max = Date.parse(max);
} else if (type === 'time') {
min = Date.parse('1970-01-01T' + min);
max = Date.parse('1970-01-01T' + max);
}
ret = utils.randomDate(min, max);
if (format === 'unix') {
// We need to undo the timezone offset fix from utils.randomDate()
ret = Math.floor((ret.getTime() - ret.getTimezoneOffset() * 60000) / 1000);
} else if (format) {
ret = fecha.format(ret, format);
} else if (type === 'time') {
// Time has a default format if one is not specified
ret = fecha.format(ret, 'HH:mm');
}
return ret;
}