title: How to format date in React material-ui date-picker?
body: <p>I'm implementing redux-form with a material-ui date-picker field. Date is perfectly set in field but when I try to send it to the back-end API format of the date is:</p>
  
  <p><code>BeginDate_1: Tue Nov 14 2017 15:03:43 GMT+0530 (IST)</code></p>
  
  <p>I'm trying to change this format to 'YYYY-mm-dd' format before sending it to the the back-end API.</p>
  
  <p>I tried <code>momentjs</code> for formatting, but I couldn't get the result I wanted. </p>
  
  <p>Here's what I've tried:</p>
  
  <p><strong>Home.js</strong></p>
  
  <pre><code>import React, {Component} from 'react';
  import {Field, reduxForm} from 'redux-form';
  import DatePicker from 'material-ui/DatePicker';
  import {connect} from 'react-redux';
  import * as moment  from 'moment';
  
  class Home extends Component {
  
  renderCalendarField= ({
                            input,
                            label,
                            meta: {touched, error},
                            children,
                            ...custom
                        }) =&gt; (
      &lt;DatePicker
          floatingLabelText={label}
          errorText={touched &amp;&amp; error}
          {...input}
          value = {input.value !== ''? new Date(input.value) : null}
          onChange={(event, value) =&gt; input.onChange(value)}
          children={children}
          {...custom}
          formatDate={(date) =&gt; moment(date).format('YYYY-MM-DD')}
  
      /&gt;
  
  )
  
  render() {
  
      const startDate = new Date();
  
      const {handleSubmit} = this.props;
  
      return (
  
          &lt;form onSubmit={handleSubmit(this.onSubmit.bind(this))}&gt;
  
  
              &lt;div&gt;
                  &lt;Field name="BeginDate_1" component={this.renderCalendarField} label="DEPARTURE" minDate={startDate} /&gt;
              &lt;/div&gt;
  
  
              &lt;div&gt;
                  &lt;button type="submit"&gt;
                      Submit
                  &lt;/button&gt;
              &lt;/div&gt;
  
          &lt;/form&gt;
  
      );
  
  }
  
  }
  
  const LogInForm = reduxForm({
  form: 'MaterialUiForm', // a unique identifier for this form
  validate
  })(Home);
  
  export default connect(mapStateTOProps, {getCity})(LogInForm);
  </code></pre>
  
  <p>The console output is still: </p>
  
  <p><code>BeginDate_1:Tue Nov 14 2017 15:03:43 GMT+0530 (IST)</code></p>
  
  <p>How can I format this date in <code>YYYY-mm-dd</code> format?</p>