Replace NSDate with Date wherever possible

This commit is contained in:
Matt Rubin 2016-12-07 00:10:39 -05:00
parent 59cccf62d0
commit b6c3c795bc
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ public struct Signature {
public let email: String
/// The time when the action happened.
public let time: NSDate
public let time: Date
/// The time zone that `time` should be interpreted relative to.
public let timeZone: NSTimeZone
@ -41,7 +41,7 @@ public struct Signature {
public init(_ signature: git_signature) {
name = String(validatingUTF8: signature.name)!
email = String(validatingUTF8: signature.email)!
time = NSDate(timeIntervalSince1970: TimeInterval(signature.when.time))
time = Date(timeIntervalSince1970: TimeInterval(signature.when.time))
timeZone = NSTimeZone(forSecondsFromGMT: NSInteger(60 * signature.when.offset))
}
}

View File

@ -36,7 +36,7 @@ class SignatureSpec: QuickSpec {
expect(signature.name).to(equal("Matt Diephouse"))
expect(signature.email).to(equal("matt@diephouse.com"))
expect(signature.time).to(equal(NSDate(timeIntervalSince1970: 1416186947)))
expect(signature.time).to(equal(Date(timeIntervalSince1970: 1416186947)))
expect(signature.timeZone.abbreviation).to(equal("GMT-5"))
}
}