The tasks.find() method finds a task by its ID.
DayPilot.Gantt.tasks.find(id)id - task ID to find
Returns a DayPilot.Task object if the task is found; otherwise null.
The supplied ID is converted to a string using .toString() and then compared using ===.
const task = gantt.tasks.find("task-1");