-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to specify Timezone(s) #4
Comments
So it looks like the problem stems from Savon. When you do @response.to_hash, it auto converts to UTC. I can use the raw XML and do Time.parse which gives the correct time zone. |
I think I have a solution: Look at commit psulightning@6a4213c in my fork. Adds a parsing for any DateTime or Time instances. |
Does the site you are working with happen to be in the same timezone that you have in your settings? |
I set config.time_zone to "Eastern Time (US & Canada)" in my application.rb. If that isn't set, it should default to use UTC. |
Not what I asked. Is the Mind-body site you are working with also in EST? |
Sorry, thought you were talking the rails site. Everything entered into On Mar 30, 2014, at 10:46, Stafford Brunk notifications@github.com wrote: Not what I asked. Is the Mind-body site you are working with also in EST? Reply to this email directly or view it on |
Ok, that's what I thought. MindBody doesn't ship timezone offsets anywhere. The timestamps coming back are usually in whatever timezone the targeted site ID is and do not specify a Timezone offset. They appear in UTC because without a specific setting Ruby assumes a timestamp is in UTC when parsing it. Dealing with this issue is made more fun when clients have sites across multiple timezones and query against multiple site ids at a time. In your situation, timestamps are in EST and you have Rails set to assume EST. If you changed Rails to central time, I bet your timestamps would no longer be correct. The Response object is not the correct place for this to be happening anyway. The MindBody models are hydrated via Virtus attribute declarations. Virtus should be handling this issue when it is hydrating the rest of the models. |
Yeah I tried setting default value in Virtus, but the problem originates On Sun, Mar 30, 2014 at 11:58 AM, Stafford Brunk
|
The type coercion on the savon side is done via nori typecasting. That typecasting should probably be disabled so Virtus can handle it (#19 is tracking that). Still only solves the problem for a 1 timezone use case. |
Agreed. But at least there would be a better ability to control through Virtus. Sent from my iPhone
|
Branch |
@wingrunr21 is this still the case with the v0.5 API? That is, timestamps that come back from the API are in the targeted SiteID's timezone. So, if you were talking to SiteID=1 in PST and SiteID=2 in EST, and you got the same timestamp in a response from both sites, they would in reality be off by 3 hours? |
To be honest, the client I was using this library with has moved on and I haven't had a chance to check MindBody's new sandbox. If they are still on the v0.5 API though, my guess is that it is still a problem. The issue is that the timestamp is in the timezone of the site but the timezone offset is not returned. Ruby assumes GMT (or whatever your default timezone is) and then calculates the offset timestamp based on whatever you are specifically asking for. |
@wingrunr21 yeah pretty sure it's still an issue with v0.5. As another sanity check, changing the business's time zone on the sandbox did nothing to affect the timestamps I received. |
MindBody, in all of their wisdom, does not ship timezone offset information with their timestamps. Sometimes their timestamps are in Pacific time, other times they are in whatever the local timezone is for the given site (which cannot be queried). So, some mechanism needs to be built in that can map incoming timestamps to the correct Timezone. This should be capable of being done via the configuration object and via environment variables.
The text was updated successfully, but these errors were encountered: