stevenyvr987 / overdrive-evergreen-opac

Automatically exported from code.google.com/p/overdrive-evergreen-opac
0 stars 0 forks source link

Overdrive date time zone are designated as UTC but it seems to be East Coast time zone #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dates from the OD server is in zulu time and should be adjusted for local time. 
There are three relevant dates:

1. Checkout expiration date
2. Hold placed date
3. Hold expiration date

Original issue reported on code.google.com by steven3...@gmail.com on 30 Jul 2014 at 7:48

GoogleCodeExporter commented 9 years ago
It is sufficient to convert date values, which are represented by ISO 8601 text 
strings, into Moment object, which will yield time in local time zone. The 
conversion takes place in the od_api module, where it can be once.

There seems to be an error in the hold placed date. When a hold is placed at 
13:41, the value becomes Wed Jul 30 2014 09:41:37 GMT-0700 (PDT), after 
conversion to a Moment. The conversion from Zulu time is correct, but the final 
result is out by 4 hours.

Original comment by steven3...@gmail.com on 30 Jul 2014 at 8:57

GoogleCodeExporter commented 9 years ago

Original comment by steven3...@gmail.com on 30 Jul 2014 at 8:57

GoogleCodeExporter commented 9 years ago
Date in response header of a placed hold request done at 1400 local time:
Wed, 30 Jul 2014 21:00:56 GMT

Date in reply from OD to the request:
holdPlacedDate: "2014-07-30T17:00:56Z"

The OD reply is 4 hours too early.

Original comment by steven3...@gmail.com on 30 Jul 2014 at 9:09

GoogleCodeExporter commented 9 years ago
Interestingly, "2014-07-30T17:00:56Z" is correct time if local New York time. 
Perhaps the ISO 8601 text string is really East Coast time but incorrectly 
labeled with the Zulu designator.

Original comment by steven3...@gmail.com on 30 Jul 2014 at 9:18

GoogleCodeExporter commented 9 years ago

Original comment by steven3...@gmail.com on 31 Jul 2014 at 5:54

GoogleCodeExporter commented 9 years ago
We are going to assume that the date-time calculated by the OD server is East 
Coast time, therefore, we can change the timezone offset from Z to -0400, eg,
from "2014-07-30T17:00:56Z" to "2014-07-30T17:00:56-0400".

When we do this, the placed date in the holds list seems correct, ie, after 
placing a hold, the placed date says, 'Hold was placed a few seconds ago' 
instead of '4 hours ago'.

Note that we have to use 4-digit offset, because of an error in the Moment 
library, see https://github.com/moment/moment/issues/1723

Original comment by steven3...@gmail.com on 13 Aug 2014 at 9:46