Skip to content

Instantly share code, notes, and snippets.

@wei-lee
Created March 16, 2018 14:53
Show Gist options
  • Save wei-lee/5cc7440aedffcaa99d8bfffe6905e692 to your computer and use it in GitHub Desktop.
Save wei-lee/5cc7440aedffcaa99d8bfffe6905e692 to your computer and use it in GitHub Desktop.
func testDateInterval() {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
let date1 = dateFormatter.date(from: "2018-03-16 14:00:00 +0000")!
let date2 = dateFormatter.date(from: "2018-03-15 14:00:00 +0000")!
let diff = date1.timeIntervalSinceNow
XCTAssertTrue(diff != 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment