How to display alert once a day

Viewed 922

I'm trying to figure out how I can make an alert popup once the user has reached their goal. However, I only want it to show once a day after it's been triggered. Apologies in advance. if my logic is off with tackling this issue.

// Check to see if hydration goal has been reached
if (waterCups >= dailyHydrationGoal) {

   // User has reached goal

    if (alert has not been fired yet today) {
        // alert pop up you reached your goal!
    }
}

How would I go about ensuring it only launches once per day?

2 Answers
Related