This my model.ts
export class Feature2 {
requestRouteTemplate: string;
requestMethod: string;
numberCount: number;
requestDate: date;
constructor(values: Object = {}) {
Object.assign(this, values);
}
}
This is component.ts
this.datas2 = [
{
'requestRouteTemplate': 'api/Tasks',
'requestMethod': 'POST',
'numberCount': 6,
'requestDate': '07/01/2017',
},
{
'requestRouteTemplate': 'api/Tasks',
'requestMethod': 'POST',
'numberCount': 3,
'requestDate': '07/02/2017',
},
I want to convert the request date variable from string to date using the moment library.
In your constructor add: this.requestDate = moment(values.requestDate, "MM-DD-YYYY").toDate();
See the documentation: