javascript - Reactjs Sort date array -


i want sort date product array ( date 1 of field in product). please suggest me. using reactjs.

please find code using.

render() {            let sorteddate = this.state.item.sort((a, b) => date.parse(new date(a.expected_ship_date("/").reverse().join("-"))) - date.parse(new date(b.expected_ship_date("/").reverse().join("-"))));           let sorteddate1 = this.state.item.sort((a, b) => new date(a.expected_ship_date) - new date(b.expected_ship_date));          return (             <tr>                 <td><input name="line_number" type="text" value={ this.state.item.line_number } disabled={ this.props.mode }  classname="form-control" onchange={ this.handleinputchange }/> </td>                 <td><input name="requested_ship_date" type="date" value={ this.state.item.expected_ship_date } disabled={ this.props.mode }  classname="form-control" onchange={ this.handleinputchange }  /></td>                  <td>{sorteddate.map( (c, i) => <div>{c.expected_ship_date}</div>)}</td>             </tr>          ); } 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -