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

**URL:** <https://community.homey.app/t/app-pro-better-logic-library-for-users/71876>\
**Category:** Apps\
**Tags:** app, tools, homey-pro, logic, bll\
**Created:** [November 7, 2022, 10:13pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876 "2022-11-07T22:13:40Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [January 13, 2023, 3:38pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/23 "2023-01-13T15:38:57Z")

</div>

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

```auto
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);

```

---

_[View the full topic](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876)._
