Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect calculation in "RemindMeLater" code #134

Open
jeromeDefReputation opened this issue Jun 25, 2019 · 0 comments
Open

Incorrect calculation in "RemindMeLater" code #134

jeromeDefReputation opened this issue Jun 25, 2019 · 0 comments

Comments

@jeromeDefReputation
Copy link

jeromeDefReputation commented Jun 25, 2019

// If the user wanted to be reminded later, has enough time passed?
        let timeIntervalOfReminder = userDefaultsObject?.doubleForKey(keyForArmchairKeyType(ArmchairKey.ReminderRequestDate))
        if let timeInterval = timeIntervalOfReminder {
            let reminderRequestDate = Date(timeIntervalSince1970: timeInterval)
            let timeSinceReminderRequest = Date().timeIntervalSince(reminderRequestDate)
            let timeUntilReminder: TimeInterval = 60 * 60 * 24 * Double(daysBeforeReminding)
            if timeSinceReminderRequest < timeUntilReminder {
                return false
            }
        } else {
            return false
        }

If the amount of time since the current timestamp and the request timestamp is greater than 0, return true if by 'true' is we can show prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant