test('should handle dates', t => { const smartClone = new SmartClone(); const date = new Date('1/1/2001'); t.is(smartClone.isCloning, false); smartClone.start(date.valueOf()); t.is(smartClone.isCloning, true); t.is(date.valueOf(), smartClone.clone); smartClone.done(); t.is(smartClone.isCloning, false); });
it('can get push time in number format', done => { // Make mock request const timeNumber = 1426802708; const body = { push_time: timeNumber, }; const { date } = PushController.getPushTime(body); expect(date.valueOf()).toEqual(timeNumber * 1000); done(); });
_(scope.attributes.map(attribute => attribute.name)) .uniq() .valueOf()
function generateFluentSchema (schema) { ;['params', 'body', 'querystring', 'query', 'headers'].forEach(key => { if (schema[key] && (schema[key].isFluentSchema || schema[key][kFluentSchema])) { schema[key] = schema[key].valueOf() } }) if (schema.response) { Object.keys(schema.response).forEach(code => { if (schema.response[code].isFluentSchema || schema.response[code][kFluentSchema]) { schema.response[code] = schema.response[code].valueOf() } }) } }
let formatDate = function(str) { let date = new Date(str); let months = 'January February March April May June July August September October November December'.split(' '); let ends = ['th', 'st', 'nd', 'rd', 'th']; let y = chalk.bold(date.getFullYear()); let m = chalk.bold(months[date.getMonth()]); let d = chalk.bold(date.getDate()); let e = chalk.bold(ends[d] || 'th'); let hh = chalk.bold(formatDigits(date.getHours(), 2)); let mm = chalk.bold(formatDigits(date.getMinutes(), 2)); let ss = chalk.bold(formatDigits(date.getSeconds(), 2)); let ms = chalk.bold(formatDigits(date.valueOf() % 1000, 3)); return `${m} ${d}${e}, ${y} at ${hh}:${mm}:${ss}.${ms}`; }
var random = function () { return parseInt(Math.random() * 10000) + (new Date()).valueOf(); }
initialize (workpath, data) { data = data || {}; data[CONFIG_VAR_WORKSPACE] = workpath; data[CONFIG_VAR_TIMESTAMP] = Math.floor(new Date().valueOf() / 1000); this.write(data); }
function this_value() { return this.valueOf(); }
it('can get expiration time in string format', done => { // Make mock request const timeStr = '2015-03-19T22:05:08Z'; const body = { expiration_time: timeStr, }; const time = PushController.getExpirationTime(body); expect(time).toEqual(new Date(timeStr).valueOf()); done(); });
let formatDate = function(str) { let date = new Date(str); let months = 'January February March April May June July August September October November December'.split(' '); let ends = ['th', 'st', 'nd', 'rd', 'th']; let y = chalk.bold(date.getFullYear()); let m = chalk.bold(months[date.getMonth()]); let d = chalk.bold(date.getDate()); let e = chalk.bold(ends[d] || 'th'); let hh = chalk.bold(formatDigits(date.getHours(), 2)); let mm = chalk.bold(formatDigits(date.getMinutes(), 2)); let ss = chalk.bold(formatDigits(date.getSeconds(), 2)); let ms = chalk.bold(formatDigits(date.valueOf() % 1000, 3)); return `${m} ${d}${e}, ${y} at ${hh}:${mm}:${ss}.${ms}`; }
_(scope.attributes.map(attribute => attribute.name)) .uniq() .valueOf()
_(scope.attributes.map(attribute => attribute.name)) .uniq() .valueOf()
var random = function () { return parseInt(Math.random() * 10000) + (new Date()).valueOf(); }
_(scope.attributes.map(attribute => attribute.name)) .uniq() .valueOf()