Skip to content

Commit 59b95e8

Browse files
committed
Merge timeZone assignment into more clear single operation
1 parent 52ad6ec commit 59b95e8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Foundation/NSCalendar.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,7 @@ public class NSCalendar : NSObject, NSCopying, NSSecureCoding {
365365
public func dateFromComponents(comps: NSDateComponents) -> NSDate? {
366366
var (vector, compDesc) = _convert(comps)
367367

368-
let oldTz = timeZone
369-
let tempTz = comps.timeZone
370-
if let tz = tempTz {
371-
self.timeZone = tz
372-
} else {
373-
self.timeZone = oldTz
374-
}
368+
self.timeZone = comps.timeZone ?? timeZone
375369

376370
var at: CFAbsoluteTime = 0.0
377371
let res: Bool = withUnsafeMutablePointer(&at) { t in

0 commit comments

Comments
 (0)