title: How to set tomorrow leave details of employee -react js
body: <p>Here i got all absent emloyee details from loopback and put into the array (data[]).code below</p>
  
  <pre><code> getAbsentDet() {
      this.props.actions.getAbsentDetails().then(() =&gt; {
        if (!this.props.common.getAbsentDetailsPending) {
  
  
          this.setState({ data: this.props.common.absDetails.emp  });
        }
      });
    }
  </code></pre>
  
  <p>Here show only employee details  who are leave today.how to do who are leave tomorrow? .my code is below...</p>
  
  <pre><code>render() {
      return (
        &lt;div className="common-right-coll-bar" id="rightMenu"&gt;
  
          &lt;Sider style={{ overflow: 'auto', height: '100vh', width: 300, right: 0, backgroundColor: '#f5f5f5', position: 'fixed', color: '#036cd2' }}&gt;
            {/* &lt;Sider style={{ height: 150, width: 300, backgroundColor: '#fff', }}&gt; */}
  
            {this.state.data.length !== 0?&lt;ul style={{ marginTop: 30 }}&gt;
            &lt;h1&gt; Absent Today&lt;/h1&gt;  
              {this.state.data.map(data =&gt;
                  (  
                    &lt;li key={data .id} style={{ padding: 5, margin: 5, marginLeft: 10 }}&gt;
                      &lt;div&gt; 
                      &lt;span&gt;
                        &lt;Badge&gt;&lt;Avatar style={{ color: '#ffffff', borderStyle: 'solid', borderWidth: 2 }} size="large" src={`./${data.profile_img}`} /&gt;&lt;/Badge&gt;
                      &lt;/span&gt;
                      &lt;span style={{ marginLeft: 10, color: '#036cd2' }}&gt;
                        {data.f_name} {data.l_name}
                      &lt;/span&gt;
  
                    &lt;/div&gt;
                    &lt;/li&gt;)
                )}
  
              &lt;div className="check" id="rightMenu" ref="check" style={{ padding: 5 }}&gt;
              &lt;/div&gt;
  
            &lt;/ul&gt; : &lt;div style={{ marginTop: 100, marginLeft: 10, fontSize: 30, borderStyle: 'solid', borderColor: 'black', textAlign: 'center', color: 'lightGray' }}&gt;No one is absent today &lt;/div&gt;}
  
          &lt;/Sider&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>This is my server code (loopback).Here show only employee details  who are leave today.how to do who are leave tomorrow? </p>
  
  <pre><code>LeaveDetails.tomo_absentEmp = function(cb) {
      var log = bunyan.createLogger({
        name: 'leaveServer-logger', streams: [
          {
            level: 'info',
            path: './log/info/log_' + moment().format('YYYY-MM-DD').toString() + '.log',
          },
          {
            level: 'error',
            path: './log/error/log_' + moment().format('YYYY-MM-DD').toString() + '.log',
          }],
        serializers: { err: bunyan.stdSerializers.err },
      });
      console.log('Request for the employee absent sheet');
      log.info({
        type: 'info', time: moment().format('YYYY-MM-DD HH:mm').toString(),
        model: 'leave-details',
        method: 'tomo_absentEmp',
      }, 'request for absent employee');
  
      let filter = { where: { leave_status: 3 }, fields: ['user_id', 'leave_start_time', 'leave_end_time','number_of_days']};
      LeaveDetails.find(filter, function(err, leaves) {
        var returnArray = [];
        var returnEle;
        var employee = app.models.employee;
        var ids = [];
        async.eachOf(leaves, function(leave, index, acb) {
          var leaveStart = moment(leave.leave_start_time).startOf('day');
          var leaveEnd = moment(leave.leave_end_time).endOf('day');
          var now = moment();
  
  
          if (now.isBetween(leaveStart, leaveEnd) &amp;&amp; !ids.includes(leave.user_id)) {
            ids.push(leave.user_id);
            employee.findById(leave.user_id, {fields: ['f_name', 'l_name', 'profile_img', 'id']}, function(err, tomoabsemp) {
              returnEle = {};
              returnEle['id'] = tomoabsemp.id;
              returnEle['f_name'] = tomoabsemp.f_name;
              returnEle['l_name'] = tomoabsemp.l_name;
              returnEle['profile_img'] = tomoabsemp.profile_img;
              returnEle['leave_start_time'] = leaveStart;
              returnEle['leave_end_time'] =leaveEnd;
              returnEle['number_of_days'] =leave.number_of_days;
  
              returnArray.push(returnEle);
              return acb(null);
            });
          }        else {
            return acb(null);
          }
        },
         function(err) {
           if (err) {
             return cb(null, err);
             log.error({
               type: 'error', time: moment().format('YYYY-MM-DD HH:mm').toString(),
               model: 'leave-details',
               method: 'tomo_absentEmp',
             }, 'absent employee responce failed');
           } else {
             console.log('send the absent employee details successfuly');
             log.info({
               type: 'success',
               model: 'leave-details',
               method: 'tomo_absentEmp',
             }, 'absent employee responce successfull');
  
             return cb(null, returnArray);
           }
         }
      );
  
      });
    };
  </code></pre>