index.js
function (time) {
    time = moment.utc(time);

    if (time.isValid() === false) {
      return Promise.reject(
        new Error('Invalid date provided for weather lookup')
      );
    }

    if (time.minute() > 30) {
      time.add('hours', 1).startOf('hour');
    } else {
      time.startOf('hour');
    }

    log('getForecastForTime', dateToForecastISO(time));

    let data = this.times[dateToForecastISO(time)] || null;

    /* istanbul ignore else  */
    if (!data && this.isInRange(time)) {
      data = this.fallbackSelector(time);
    }

    /* istanbul ignore else  */
    if (data) {
      data = Object.assign({}, data, data.location);
      delete data.location;
    }

    return Promise.resolve(data);
  }
function (time) {
    time = moment.utc(time);

    if (time.isValid() === false) {
      return Promise.reject(
        new Error('Invalid date provided for weather lookup')
      );
    }

    if (time.minute() > 30) {
      time.add('hours', 1).startOf('hour');
    } else {
      time.startOf('hour');
    }

    log('getForecastForTime', dateToForecastISO(time));

    let data = this.times[dateToForecastISO(time)] || null;

    /* istanbul ignore else  */
    if (!data && this.isInRange(time)) {
      data = this.fallbackSelector(time);
    }

    /* istanbul ignore else  */
    if (data) {
      data = Object.assign({}, data, data.location);
      delete data.location;
    }

    return Promise.resolve(data);
  }
function ( time ) { time = moment . utc ( time ) ; if ( time . isValid ( ) === false ) { return Promise . reject ( new Error ( 'Invalid date provided for weather lookup' ) ) ; } if ( time . minute ( ) > 30 ) { time . add ( 'hours' , 1 ) . startOf ( 'hour' ) ; } else { time . startOf ( 'hour' ) ; } log ( 'getForecastForTime' , dateToForecastISO ( time ) ) ; let data = this . times [ dateToForecastISO ( time ) ] || null ; /* istanbul ignore else  */ if ( ! data && this . isInRange ( time ) ) { data = this . fallbackSelector ( time ) ; } /* istanbul ignore else  */ if ( data ) { data = Object . assign ( { } , data , data . location ) ; delete data . location ; } return Promise . resolve ( data ) ; }
Returns a forecast for a given time.
@param {String|Date} time
@param {Function}    callback
Returns a forecast for a given time .