Skip to content

Commit

Permalink
Never use a negative amount of days for survey params.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed May 25, 2024
1 parent 398e111 commit 3d9aefe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ final class SurveyURLBuilder {
}

private func daysSince(date storedDate: Date) -> Int? {
return Calendar.current.dateComponents([.day], from: storedDate, to: Date()).day
if let days = Calendar.current.dateComponents([.day], from: storedDate, to: Date()).day {
return abs(days)
}

return nil
}

}

0 comments on commit 3d9aefe

Please sign in to comment.