Software/greenhouse-app/src/app/components/App.js
// function to make a query of all availabe dates
function to make a query of all availabe dates
function to make a query of all availabe dates
fetchGreenhouseAvailableDates() {
    fetch(`/api/greenhouse/datesInst/${this.state.institution}`)
      .then((res) =>
        res.json().then((data) => {
          var dates = data.map((dat) => {
            return new Date(moment(dat.createdAt).format("ll")).toDateString();
          });
          dates.push(
            new Date(moment(this.dateComp).format("ll")).toDateString()
          );
          this.setState({ availableDates: dates });
        })
      )
      .catch((err) => console.error(err));
  }
fetchGreenhouseAvailableDates ( ) { fetch ( ` ${ this . state . institution } ` ) . then ( ( res ) => res . json ( ) . then ( ( data ) => { var dates = data . map ( ( dat ) => { return new Date ( moment ( dat . createdAt ) . format ( "ll" ) ) . toDateString ( ) ; } ) ; dates . push ( new Date ( moment ( this . dateComp ) . format ( "ll" ) ) . toDateString ( ) ) ; this . setState ( { availableDates : dates } ) ; } ) ) . catch ( ( err ) => console . error ( err ) ) ; }
function to make a query of all availabe dates
function to make a query of all availabe dates
// console.log(this.state.availableDates);