I am passing a date value from a selected angular gridrow to my modal popup. One of the field is a Date field.
In my typescript, I got the databinding object defined as
public request = {
"MeetingDate": Date
};
When I call the function to open the modal popup,
editModal(content, selectedRow) {
const mdt = new Date(selectedRow.meetingDate);
const mm = mdt.getmonth();
this.request.meetingDate = { 'year': mdt.getFullYear(), 'month': mm, 'day': mdt.getDate() };
this.modalService.open(content);
}
I am getting an error stating
Type '{ 'year': number; 'month': numberl 'day': number; }' is not assigna ble to to type DateConstructor
Object literal may only specify konw properties, and ''year'' does not exist in type 'DateConstructor'
I tried a few other methods like this.request.meetingDate = selectedMeetingDt but the value does not show up on the UI datepicker. I also tried meetingDate = new Date(...) but that is not working either.
Even though I declare the property to be Date, in the function, the cursor is show me that its a DateConstructor.
Any help is greatly appreciated.
Thanks.
const mm - mdt.getmonth();is this line correct ?