nasa / api-docs

api.nasa.gov
http://nasa.github.io/api-docs/
450 stars 109 forks source link

API Response Date Value UTC? #81

Closed krlbaker closed 7 years ago

krlbaker commented 7 years ago

I have noticed that the "date" value in the API response rolls to the next day around 7pm EST. My guess is the date is being set to UTC. Can anyone confirm? This is the request I made at 1pm EST, if I make the same request after 7pm EST tonight, the date value will be 2017-01-26.

{
  "date": "2017-01-25",
  "explanation": "Cassini is being prepared to dive into Saturn. The robotic spacecraft that has been orbiting and exploring Saturn for over a decade will end its mission in September with a spectacular atmospheric plunge.  Pictured here is a diagram of Cassini's remaining orbits, each taking about one week.  Cassini is scheduled to complete a few months of orbits that will take it just outside Saturn's outermost ring F.  Then, in April, Titan will give Cassini a gravitational pull into Proximal orbits, the last of which, on September 15, will impact Saturn and cause the spacecraft to implode and melt.  Cassini's Grand Finale orbits are designed to record data and first-ever views from inside the rings -- between the rings and planet -- as well as some small moons interspersed in the rings. Cassini's demise is designed to protect any life that may occur around Saturn or its moons from contamination by Cassini itself.   Free Download: APOD 2017 Calendar: NASA Images",
  "hdurl": "http://apod.nasa.gov/apod/image/1701/GrandFinale_Cassini_1600.jpg",
  "media_type": "image",
  "service_version": "v1",
  "title": "Cassini's Grand Finale Tour at Saturn",
  "url": "http://apod.nasa.gov/apod/image/1701/GrandFinale_Cassini_960.jpg"
}
ehalls commented 7 years ago

Why not improve the accuracy by including HH:MM:SS as stored in a typical rdbms? Trimming that information only leads to a need to possess knowledge about the system that produced the output. Hence coupling you to depending on docume tation and a forum, such as this mailing list.

On 25 Jan 2017 6:08 p.m., "Kris" notifications@github.com wrote:

I have noticed that the "date" value in the API response rolls to the next day around 7pm EST. My guess is the date is being set to UTC. Can anyone confirm? This is the request I made at 1pm EST, if I make the same request after 7pm EST tonight, the date value will be 2017-01-26.

{ "date": "2017-01-25", "explanation": "Cassini is being prepared to dive into Saturn. The robotic spacecraft that has been orbiting and exploring Saturn for over a decade will end its mission in September with a spectacular atmospheric plunge. Pictured here is a diagram of Cassini's remaining orbits, each taking about one week. Cassini is scheduled to complete a few months of orbits that will take it just outside Saturn's outermost ring F. Then, in April, Titan will give Cassini a gravitational pull into Proximal orbits, the last of which, on September 15, will impact Saturn and cause the spacecraft to implode and melt. Cassini's Grand Finale orbits are designed to record data and first-ever views from inside the rings -- between the rings and planet -- as well as some small moons interspersed in the rings. Cassini's demise is designed to protect any life that may occur around Saturn or its moons from contamination by Cassini itself. Free Download: APOD 2017 Calendar: NASA Images", "hdurl": "http://apod.nasa.gov/apod/image/1701/GrandFinale_Cassini_1600.jpg", "media_type": "image", "service_version": "v1", "title": "Cassini's Grand Finale Tour at Saturn", "url": "http://apod.nasa.gov/apod/image/1701/GrandFinale_Cassini_960.jpg" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nasa/api-docs/issues/81, or mute the thread https://github.com/notifications/unsubscribe-auth/AASfL62fM9GE-0DR5tfSxTjtTaXYJ7m1ks5rV4-UgaJpZM4Lt0Aw .

krlbaker commented 7 years ago

A follow up question / thought, when does the API roll to the next day for the other values? Is that at UTC midnight or EST midnight or CST midnight?

brianthomas commented 7 years ago

Hi All,

The title seems deceptive, but I think you are specifically talking about the APOD API service, right?

If so, then yes, it’s a known issue. The problem flows from the fact that the Heroku backing server is supplying time in UTC but the original site where APOD is hosted is on the East Coast of the US.

It’s a long standing issue which I have half-heartedly tried to fix (spent an hour on it last year) and haven’t had the time to come back to.

=brian

From: Kris notifications@github.com Reply-To: nasa/api-docs reply@reply.github.com Date: Wednesday, January 25, 2017 at 3:06 PM To: nasa/api-docs api-docs@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [nasa/api-docs] API Response Date Value UTC? (#81)

A follow up question / thought, when does the API roll to the next day for the other values? Is that at UTC midnight or EST midnight or CST midnight?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nasa/api-docs/issues/81#issuecomment-275218052, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADzTmbjhUHCqm65NYgaRAVYkDFhpMI95ks5rV6s4gaJpZM4Lt0Aw.

ehalls commented 7 years ago

I am not sure of the requirements but generally:

It should be up to the consumer to decide the final date format. Date should be turned into a value object containing two properties. One with the human readable format, if necessary, and a generic timestamp from which it was derived so that location is irrelevant.

This reduces the minor processing overhead which will most likely occur when the json field is mapped to a date object on the consumer's end.

On 25 Jan 2017 21:23, "Brian Thomas" notifications@github.com wrote:

Hi All,

The title seems deceptive, but I think you are specifically talking about the APOD API service, right?

If so, then yes, it’s a known issue. The problem flows from the fact that the Heroku backing server is supplying time in UTC but the original site where APOD is hosted is on the East Coast of the US.

It’s a long standing issue which I have half-heartedly tried to fix (spent an hour on it last year) and haven’t had the time to come back to.

=brian

From: Kris notifications@github.com Reply-To: nasa/api-docs reply@reply.github.com Date: Wednesday, January 25, 2017 at 3:06 PM To: nasa/api-docs api-docs@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [nasa/api-docs] API Response Date Value UTC? (#81)

A follow up question / thought, when does the API roll to the next day for the other values? Is that at UTC midnight or EST midnight or CST midnight?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ nasa/api-docs/issues/81#issuecomment-275218052, or mute the thread< https://github.com/notifications/unsubscribe-auth/ ADzTmbjhUHCqm65NYgaRAVYkDFhpMI95ks5rV6s4gaJpZM4Lt0Aw>.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nasa/api-docs/issues/81#issuecomment-275237038, or mute the thread https://github.com/notifications/unsubscribe-auth/AASfL7TvRRjdK4ePynk9JxFXdKU5t3k9ks5rV71BgaJpZM4Lt0Aw .