Data comes from the server with dates in the form of arrays and a Dictionary in the following form:

{ "2016-05-08T00:00:00+03:00": 1, "2016-05-09T00:00:00+03:00": 2, "2016-05-10T00:00:00+03:00": 3, "2016-05-11T00:00:00+03:00": 1 }, { "2016-05-08T00:00:00+03:00", "2016-05-09T00:00:00+03:00", "2016-05-10T00:00:00+03:00", "2016-05-11T00:00:00+03:00" } 

How safe is it to store and process data in NSDate if the only significant part is the date? There is a suspicion that this is a very unstable data format, because of which errors may occur in users in another time zone.

    2 answers 2

    It seems to me that it is safe, but I would use such a key as the key.

     NSNumber *key = @([[dateFormat dateFromString:dateStr] timeIntervalSince1970]); 

    it will be exactly the same everywhere, regardless of the timezone.

      If the significant part is only a date, then use only the date as the key ( yyyy-MM-dd ). So it will be more correct and understandable than a second.

      But make sure the date is unique.