title: Changing time format when sending from React.js to the backend server
body: <p>I'm trying to send dates range to backend node server. Everything works just fine and the time I'm choosing in my calendar is correctly picked, ie. dates I'm choosing in the calendar are the same just before sending it to the backend. But when I'm checking my payload inside console's network the day is not correct anymore - it is always one day earlier. For some reason I don't know dates are changed with that one day. </p>
  
  <p>Here's my chunk of code: </p>
  
  <pre><code>import React, { Component } from 'react';
  import Calendar from 'react-calendar';
  import { connect } from 'react-redux';
  import * as actions from '../../actions';
  
  class Holidays extends Component {
  
      state = { date: [new Date(), new Date()], dates: [] }
  
      calculateRange(dateRange) {
          const getDates = (startDate, endDate) =&gt; {
              let dates = [],
                  currentDate = startDate,
                  addDays = function(days) {
                    const date = new Date(this.valueOf());
                    date.setDate(date.getDate() + days);
                    return date;
                  };
              while (currentDate &lt;= endDate) {
                dates.push(currentDate);
                currentDate = addDays.call(currentDate, 1);
              }
              return dates;
            };
  
            const dates = getDates(new Date(dateRange[0]), new Date(dateRange[1]));      
            this.setState({ dates });                                                                                                     
      }
  
      onChange = date =&gt; this.calculateRange(date[0], date[1]);
  
      handleClick() {
          const { dates } = this.state;
          console.log(dates); // -----here still I'm getting correct values
          const { sendDateRange } = this.props;
          sendDateRange({ dates });
      }
  
      render() { 
          return ( 
              &lt;div className="centered-column"&gt;
                  &lt;h1&gt;Holidays&lt;/h1&gt;
                  &lt;Calendar
                      onChange={(date) =&gt; this.calculateRange(date)}
                      value={this.state.date}
                      locale="pl"
                      returnValue="range"
                      selectRange={true}
                  /&gt;
                  &lt;a className="btn margin__vertical" onClick={() =&gt;  this.handleClick()}&gt;BOOK&lt;/a&gt;
              &lt;/div&gt;
           );
      }
  }
  
  export default connect(null, actions)(Holidays);
  </code></pre>
  
  <p>For example here's my log (at the position the same as above) when trying to choose 20th and 21st of August.</p>
  
  <p> </p>
  
  <pre><code>[Mon Aug 20 2018 00:00:00 GMT+0200 (Central European Summer Time), Tue Aug 21 2018 00:00:00 GMT+0200 (Central European Summer Time)]
  </code></pre>
  
  <p>By my payload shows this:</p>
  
  <pre><code>"2018-08-19T22:00:00.000Z", "2018-08-20T22:00:00.000Z"
  </code></pre>