I’m getting the error Uncaught DayPilot.Duration(): Invalid start argument, DayPilot.Date expected and my events are not being loaded from the database. I have this:
scheduler.events.load("/api/Tasks");
In my controller class:
// GET: api/Tasks
[HttpGet]
public async Task<ActionResult<IEnumerable<Task>>> GetTasks()
{
return await _context.Tasks.ToListAsync();
}
And in my model:
public class Task
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
[JsonPropertyName("resource")]
public int ResourceId { get; set; }
[JsonIgnore, IgnoreDataMember]
public Machine Machine { get; set; }
public string Text { get; set; }
public string Color { get; set; }
public int JobId { get; set; }
public int? NextId { get; set; }
}
When I print with console.log() I can see the data:
{id: 1, start: '2024-10-01T09:00:00', end: '2024-10-01T10:00:00', resource: 1, text: 'Carlos',…}
Thanks for any help.