lib/flightstats.js
function( options, callback ) {

    debug( 'lookup' )

    var now = Date.now()
    var target = options.date.getTime()

    // NOTE: `.status()` is only available within a window of -7 to +3 days
    var timeMin = now - ( 8 * 24 ) * 60 * 60 * 1000
    var timeMax = now + ( 3 * 24 ) * 60 * 60 * 1000

    var method = target < timeMin || target > timeMax ?
      'schedule' : 'status'

    debug( 'lookup:time:target ', target )
    debug( 'lookup:time:window', timeMin, timeMax )
    debug( 'lookup:type', method )

    return this[ method ]( options, callback )

  }
function( options, callback ) {

    debug( 'lookup' )

    var now = Date.now()
    var target = options.date.getTime()

    // NOTE: `.status()` is only available within a window of -7 to +3 days
    var timeMin = now - ( 8 * 24 ) * 60 * 60 * 1000
    var timeMax = now + ( 3 * 24 ) * 60 * 60 * 1000

    var method = target < timeMin || target > timeMax ?
      'schedule' : 'status'

    debug( 'lookup:time:target ', target )
    debug( 'lookup:time:window', timeMin, timeMax )
    debug( 'lookup:type', method )

    return this[ method ]( options, callback )

  }
function ( options , callback ) { debug ( 'lookup' ) var now = Date . now ( ) var target = options . date . getTime ( ) // NOTE: `.status()` is only available within a window of -7 to +3 days var timeMin = now - ( 8 * 24 ) * 60 * 60 * 1000 var timeMax = now + ( 3 * 24 ) * 60 * 60 * 1000 var method = target < timeMin || target > timeMax ? 'schedule' : 'status' debug ( 'lookup:time:target ' , target ) debug ( 'lookup:time:window' , timeMin , timeMax ) debug ( 'lookup:type' , method ) return this [ method ] ( options , callback ) }
Look up a flight
@param {Object} options
@param {Date} options.date
@param {String} options.airlineCode
@param {String} options.flightNumber
@param {?String} [options.airport] optional
@param {?String} [options.direction='arr'] optional
@param {?Array<String>} [options.extendedOptions] optional
@param {Function} callback
@return {Request}
Look up a flight