[APP][Pro] Better Logic Library - For Users

I’m trying to figure out if I can use BLL in advanced flows to calculate what time I should start a task, where I know how many minutes it takes to complete the task and when it should be ready.

Say I want a to start a task $tasktime minutes before 18:00. Somehow can’t get my head over how to do this.

The result should be something I can use to compare to for a trigger.
For example every five minutes I can run a logic test see if it is now within $tasktime minutes before 18:00 and start the task.

In Homeyscript it would be

const endDate = new Date();
endDate.toLocaleTimeString();

endDate.setHours(18, 00);

var startDate = new Date(endDate);

var durationInMinutes = 20;

startDate.setMinutes(endDate.getMinutes() - durationInMinutes);
startDate.toLocaleTimeString();

console.log(startDate);