Skip to content

Commit 2ef2e06

Browse files
committed
Merge pull request #267 from hpux735/utc
Ensure that the timezone and calendar property is set
2 parents a4ee50c + b179424 commit 2ef2e06

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)