How to use the date function from assert-plus

Find comprehensive JavaScript assert-plus.date code examples handpicked from public code repositorys.

273
274
275
276
277
278
279
280
281
282
283
 * @param {Date} now (optional) - a date object to compare to
 * @return {String} - printable string
 */
function longAgo(when, now) {
    now = now || new Date();
    assert.date(now, 'now');


    var seconds = Math.round((now - when) / 1000);
    var times = [
        seconds / 60 / 60 / 24 / 365, // years
fork icon38
star icon55
watch icon41