14

I have to format the date to DD-MMM-YYYY format. I Am using reactjs. The date is formatted in IE but not in Google Chrome. Please suggest.

<input  name="requested_order_ship_date"  type="date" 
        disabled={ this.state.mode } 
        value={ moment(this.state.item.requested_order_ship_date).format("DD-MMM-YYYY") } 
        className="form-control"  onChange={ this.handleInputChange } />
Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400

1 Answers1

24

This actually has nothing to do with React. For <input type="date" /> values, browsers expect the value of the date to be in YYYY-MM-DD format.

See Is there any way to change input type="date" format? for more info.

Zach Saucier
  • 24,871
  • 12
  • 85
  • 147
Reid Evans
  • 1,611
  • 15
  • 19