src/DateSlider.js
/**
   * Pure function to generate an array of objects that can be used by the FlatList.
   *
   * The FlatList renders a 'week' as a new item. This function
   * creates a number of entries equal to the weeks parameter
   * and starting from the fromDate paramater. The fromDate
   * needs to be set to the correct weekday used to start each WeekView
   * by the callee.
   *
   * @param {moment} fromDate
   *  The starting date for the array of weeks to be generated
   * @param {number} weeks
   *  The number of weeks to be generated
   * @param {moment} selectedDate
   *  The date that is current selected
   * @param {number} isoStartDay
   *  The ISOWeekday number that starts the week being displayed (1 - 7)
   * @returns {Array<Object>}
   *
   * @memberof DateSlider
   */
Pure function to generate an array of objects that can be used by the FlatList.
The FlatList renders a 'week' as a new item. This function
creates a number of entries equal to the weeks parameter
and starting from the fromDate paramater. The fromDate
needs to be set to the correct weekday used to start each WeekView
by the callee.




Pure function to generate an array of objects that can be used by the FlatList . The FlatList renders a ' week ' as a new item . This function creates a number of entries equal to the weeks parameter and starting from the fromDate paramater . The fromDate needs to be set to the correct weekday used to start each WeekView by the callee .
_generateDates(fromDate, weeks, selectedDate, isoStartDay) {
    const startOfSelectedWeek = DateFns.getStartOfWeek(
      selectedDate,
      isoStartDay
    );
    return _.map(_.range(weeks), i => {
      const weekStartDate = fromDate.clone().add(i, "weeks");
      if (startOfSelectedWeek.isSame(weekStartDate, "day")) {
        this.selectedIndex = i;
      }
      return {
        key: weekStartDate.toISOString(),
        date: weekStartDate,
        arrSelected: this._generateArrSelected(
          weekStartDate,
          startOfSelectedWeek,
          selectedDate,
          isoStartDay
        )
      };
    });
  }
_generateDates ( fromDate , weeks , selectedDate , isoStartDay ) { const startOfSelectedWeek = DateFns . getStartOfWeek ( selectedDate , isoStartDay ) ; return _ . map ( _ . range ( weeks ) , i => { const weekStartDate = fromDate . clone ( ) . add ( i , "weeks" ) ; if ( startOfSelectedWeek . isSame ( weekStartDate , "day" ) ) { this . selectedIndex = i ; } return { key : weekStartDate . toISOString ( ) , date : weekStartDate , arrSelected : this . _generateArrSelected ( weekStartDate , startOfSelectedWeek , selectedDate , isoStartDay ) } ; } ) ; }
Pure function to generate an array of objects that can be used by the FlatList.
Pure function to generate an array of objects that can be used by the FlatList .