I am currently utilizing fullcalendar for my project. However, I would like to utilize my local models instead of fullcalendar's model. The issue arises when attempting to create a new instance of my own model, as it displays the following error message:
Argument of type 'DateInput' is not assignable to parameter of type 'Date'.
Below is my event.model.ts
file:
export class EventModel {
public eventId: string;
public eventName: string;
public eventStart: Date;
constructor(
eventId: string,
eventName: string,
eventStart: Date
)
{
this.eventId = eventId;
this.eventName = eventName;
this.eventStart = eventStart;
}
}
Here is how fullcalendar is initialized:
import { EventInput } from '@fullcalendar/core';
Usage:
private events: EventInput[] = [
{ id: "1", title: 'Test', start: new Date() }
];
getEvent(id: string) : EventModel {
var event = this.events.find(x => x.id === id);
if (event) {
EventModel model = new EventModel(event.id, event.title, event.start); //the event.start Throws error!
}
}