avishaan / lightTribe

LightTribe Backend and Collaboration Doc
2 stars 0 forks source link

Timeline dates should be returned in TimeStamp #66

Closed footnote closed 9 years ago

footnote commented 9 years ago

GET /v1/users/{userId}/posts

[
  {
    "_id": "54f44c5d26352b1b9755b12f",
    "createDate": "2015-03-04T07:36:56.224Z",
    "text": "This is a very relavent post to me"
  }
]
footnote commented 9 years ago

This route as well /v1/posts

avishaan commented 9 years ago

This seems like it was already being returned. I added the sort order in commit afcdec4 because you asked for it on another issue. Can you confirm this is an issue?

avishaan commented 9 years ago

@ShadiFares

footnote commented 9 years ago

Check the format of createDate parameter, please check to convert to unix timestamp to be able to use 1 method for all dates and time

avishaan commented 9 years ago

What is currently being returned for you? We typically use JSON date objects which have built in conversation methods in most languages.

avishaan commented 9 years ago

Perhaps a screenshot of what is being returned for you as well as the route and username/token you are using will help us debug if you are still encountering this issue.

avishaan commented 9 years ago

@ShadiFares

footnote commented 9 years ago

The expectation is to get the date like this 1443398069 (Timestamp Format) as we used to do in Quipics

The date marked up in the attached screenshot should be in tiemstamp format like this one and the other routes too, any date that is returned in any route should be returned in Unix format 1443398069

screen shot 2015-09-28 at 1 46 08 am
avishaan commented 9 years ago

The date in the attached screenshot is the date in the response header. Your application shouldn't be using anything in the header for displaying to the user.

avishaan commented 9 years ago

Also the format in the very first screenshot is the official ISO_8601 date spec https://en.wikipedia.org/wiki/ISO_8601. I think you can convert the ISO_8601 to a date in iOS using Swift as follows. I am sure there is an Objective-C equivalent.

let dateFormatter = NSDateFormatter()
let enUSPosixLocale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.locale = enUSPosixLocale
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"

let iso8601String = dateFormatter.stringFromDate(NSDate())
avishaan commented 9 years ago

@footnote @ShadiFares let me know if this solved the issue.

avishaan commented 9 years ago

@footnote please followup with this.