How to get date from Date Picker and show in the table? Material-UI. ReactJS

时间:2017-12-18 08:18:38

标签: javascript html reactjs material-ui

I use Date Picker component from Material-UI for React JS. I want to show the selected date on the table. A date is an object and I have an error when trying to show in a table row. How to do this?

System.IO.FileNotFoundException : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

3 个答案:

答案 0 :(得分:3)

发送给handleChangeDate处理程序的日期属于object类型。您需要将其转换为日期字符串才能在TableRowColumn内进行渲染。

export default class AddTaskDialog extends Component {
 constructor(props) {
 super(props);
 this.state = { controlledDate: new Date() };
 this.handleChangeDate = this.handleChangeDate.bind(this);
}

handleChangeDate = (event, date) => {
  this.setState({
    controlledDate: date
  });
};

// INSIDE RENDER
<TableRowColumn>{this.state.controlledDate.toDateString()}</TableRowColumn>

const date = new Date();

console.log(typeof date);
   
console.log(date.toDateString());

答案 1 :(得分:1)

You are missing the state in the TableRow.



    // queue object was instantiated in pt#3
    queue.add(jsObjRequest);

答案 2 :(得分:1)

{
  "script": "ctx._source.timenow2 = ctx._now"
}

not {this.state.controlledDate}