Skip to content

ModelRocket 1.2.2

Compare
Choose a tag to compare
@jlandon jlandon released this 18 Nov 04:57
· 19 commits to master since this release

Updated

  • Built-in date formatter to accept non-GMT date formats. ISO8601 formatting (yyyy-MM-dd'T'HH:mm:ss.SSSZ) is still required, but a future release will contain support for more formats. In the meantime, you can use this pattern if your models require a different format:
private let dateFormatter = {
   let formatter = NSDateFormatter()
   formatter.format = "yyyy-MM-dd"
   return formatter
}()

private let _date = Property<String>(key: "date")
public var date: NSDate? {
   guard let date = _date.value else { return nil }
   return dateFormatter.dateFromString(date)
}

Fixed

  • Issue where time zones weren't respected while parsing JSON to/from NSDate objects