Hi,

In CouchbaseLite I've been using [CBLJSON dateWithJSONObject:] and [CBLJSON 
JSONObjectWithDate:] to retrieve and store date information.

The date in the database looks like this in UTC:

{

    date = "2018-01-12T07:00:00.000Z";

}

But I'd like to store the time zone information now along with the date.

When I use the time zone variant of [CBLJSON JSONObjectWithDate:timezone:] 
this is what I get:
{

    date = "2018-01-12T00:00:00.000-07:00";
}

So the time zone offset is now added to the time stamp.

I'm assuming that dateWithJSONObject can interpret both formats.

But I'm thinking maybe rather than using the time zone API variant to 
generate the date value to store in the database, I should continue using 
the UTC version and then store the time zone name (e.g. "America/Edmonton") 
separately. This way I take offsets and DST out of the equation and let the 
OS figure that out for me by creating my own NSTimeZone for the given time 
zone name. Then I can use that to display the time to the user in that time 
zone.

What do you think? Is it better to use JSONObjectWithDate or 
JSONObjectWithDate:timezone?

Thanks,

Brendan


-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/85bf8ced-e370-4b83-a2ca-d6d4d3d87e5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to