For Loop calculations

Hello,

I have a FOR Loop which gives me a notification everyday on a certain chosen time, at an amount of the calculated days of 2 dates.

The problem is, whenever the notification is getting activated, it is making calculations for every notification that will be received in one time (example 1 year, 365 loops), which results in long loading and freezing the app. I would like this just to calculate 1 at a time, at every day. 

Here is the code:

for i = 0, days do counter = counter + 1 notificationDate = notificationDate + 86400 local utcTime = os.date( "!\*t", notificationDate ) print( json.prettify( utcTime ) ) notificationID = notifications.scheduleNotification( utcTime, notiOptions ) end

Could I get some help with this?

EDIT:

When reopening the app, it takes a lot longer to load because of the calculations and sometimes it crahes when opening.

If you only need 1 calculation at a time then why use the for loop?

If I wont use a for loop, how could I repeat the notification everyday, for the calculated dayy?

If you only need 1 calculation at a time then why use the for loop?

If I wont use a for loop, how could I repeat the notification everyday, for the calculated dayy?