ServiceStack.Swift Date are always nil


There seems to be an issue with the date handling code when using the ISO8601 format. I have a DTO that returns an object containing a DateTime and t he date is always nil in Swift. Itraced the code in JsonServiceClient.swift and it looks like the date parsing code does not handle the time offset in the date. Is there an option I need to turn on to be able to parse the ISO8601 format?


You can reproduce the issue in XCode without using the JsonSerciceClient like so:

// (it prints nil)
.Net DTO:
    public class MyRequest : IReturn<MyResponse>

    public class MyResponse
        public DateTime MyDate { get; set; }

        public PropertyBagRequest()
            MyDate = DateTime.Now;
    JsConfig.DateHandler = DateHandler.ISO8601;
Swift code:
    let jsonClient = JsonServiceClient(baseUrl: "...")
    var resonse = try jsonClient.get(

DateTime’s are converted to NSDate which is a specific point in time that doesn’t have a time zone.
I personally recommend dates are sent as UTC across the wire.

I just realize that my test project used DateTime.Now instead of DateTime.UtcNow.

Thanks for the info.