forked from covidwatchorg/covidwatch-ios-tcn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request covidwatchorg#71 from covid19risk/updateGlobalState
Global state handling updates
- Loading branch information
Showing
9 changed files
with
147 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// IsWithinXDaysOfToday.swift | ||
// COVIDWatch iOS | ||
// | ||
// Created by Isaiah Becker-Mayer on 4/14/20. | ||
// Copyright © 2020 IZE. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
func isDWithinXDaysOfToday(D: Date, X: Int) -> Bool { | ||
let calendar = Calendar.current | ||
let now = Date() | ||
|
||
let components = calendar.dateComponents([.day], from: D, to: now) | ||
if let numDays = components.day { | ||
if numDays <= X { | ||
return true | ||
} else { | ||
return false | ||
} | ||
} | ||
return false // Should not reach here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.