How to split data to get like 2018-07-17
from the following code:
getCompanyHolydayLeave() {
this.props.actions.getCompanyLeaveDetails().then(() => {
if (!this.props.common.getCompanyLeaveDetailsPending) {
const poyaArray= this.props.common.companyLeave
var result = poyaArray.map((poyaArray) => poyaArray.date )
var xData= result.toString().split("T")
this.setState({ companyLeave:xData });
}
});
}
My output xdata
like this.
0: "2018-04-29"
1: "18:30:00.000Z,2018-05-06"
2: "18:30:00.000Z,2018-05-28"
3: "18:30:00.000Z,2018-06-26"
I need like this:
0: "2018-04-29"
1: "2018-05-06"
How can I do so?