SkygearIO / skygear-SDK-iOS

Skygear SDK for iOS
https://skygear.io
Other
10 stars 28 forks source link

[Serialization] Date serialization should never be affected by environment #128

Open louischan-oursky opened 7 years ago

louischan-oursky commented 7 years ago

If a device is configured to use Japanese calendar (or any other non-Gregorian calender) instead of Gregorian calendar. Date serialization gives surprising result.

"2017-09-04T00:00:00.0000Z" gives a NSDate with year 4005 (2017 + 2017 - 29) (since Heisei 29 is Gregorian 2017)

This problem is mentioned in https://stackoverflow.com/questions/39562517/dateformatter-changes-date-by-500-years and the answer contains a proper fix by configuring NSDateFormatter to a predictable timezone and locale rather relying on the environment.

louischan-oursky commented 7 years ago

We may also need to check our other client side SDK implementations to see if they suffer this problem.