Skip to content

Commit b179424

Browse files
committed
Ensure that the timezone property is always set
1 parent 5dc50a0 commit b179424

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Foundation/NSDateFormatter.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public class NSDateFormatter : NSFormatter {
2323
#endif
2424
let obj = CFDateFormatterCreate(kCFAllocatorSystemDefault, locale._cfObject, dateStyle, timeStyle)
2525
// TODO: Set up attributes here
26+
if calendar != nil {
27+
CFDateFormatterSetProperty(obj, kCFDateFormatterCalendar, calendar._cfObject)
28+
}
29+
CFDateFormatterSetProperty(obj, kCFDateFormatterTimeZone, timeZone._cfObject)
2630
if let dateFormat = _dateFormat {
2731
CFDateFormatterSetFormat(obj, dateFormat._cfObject)
2832
}

0 commit comments

Comments
 (0)