Reputation:
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 } />
Upvotes: 17
Views: 131147
Reputation: 1641
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.
Upvotes: 26