index.js
function() {
    var time = null;

    if (this.method === 'from now') {
      time = ago.fromNow(this.amount, this.unit);
    } else if (this.method === 'ago') {
      time = ago(this.amount, this.unit);
    } else {
      throw new Error('Invalid method: ' + this.method);
    }

    return new Date(time);
  }
function() {
    var time = null;

    if (this.method === 'from now') {
      time = ago.fromNow(this.amount, this.unit);
    } else if (this.method === 'ago') {
      time = ago(this.amount, this.unit);
    } else {
      throw new Error('Invalid method: ' + this.method);
    }

    return new Date(time);
  }
function ( ) { var time = null ; if ( this . method === 'from now' ) { time = ago . fromNow ( this . amount , this . unit ) ; } else if ( this . method === 'ago' ) { time = ago ( this . amount , this . unit ) ; } else { throw new Error ( 'Invalid method: ' + this . method ) ; } return new Date ( time ) ; }
Build the desired date and return it.

@returns {Date}
@api public
Build the desired date and return it .