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
Database and Ruby have inconsistent time zone info #215
Comments
I ran into the same issue. Did you manage to solve this @c2ofh ? |
@meacuna I was able to solve it, by setting the timezone right before the request. |
For future readers, this means Ruby and your database have conflicting time zone info. Based on the time returned, you can determine which is out of date and upgrade accordingly. |
I'm unclear about what you mean by "upgrade" I'm trying to figure out how/when this check is done. Currently, my app works fine, but my tests don't seem to work at all. Could you clarify WHY this is an error, and what it means?
|
Groupdate does the initial grouping on the database server for performance (uses database time zone), then fills in missing data points in Ruby (uses Ruby time zone). If these are inconsistent, you can get incorrect results. See #209. To fix, determine which needs updated. You can do this by looking at the time returned in the error. |
I'm confused about this because I don't get this error in development or production, only in my test suite. If I pass a different time_zone to group_by_period, it seems to trigger this error, which, it seems is why I don't get the error. We seem to be passing the parameter because different users want to see these events localized and grouped based on their time (so users in different timezones would see different graphs). I don't know that this makes sense or is constructive, but it seems to be the way things are done. I definitely don't have this kind of expertise, where it concerns times and timezones, so I may need it explained like I'm 5. I'm really sorry to be so dense. Thanks,
|
The error is specific to the time zone and data retrieved. Not all time zones will have inconsistent data, and not all data retrieved will be affected by inconsistent time zone data. You'll only see the error message if Groupdate detects that the data retrieved *is* affected by this issue. Unfortunately, I don't have the bandwidth to help with app-specific issues, but maybe you can get help on Stack Overflow. |
Yeah. That's fine, I understand that you have other responsibilities. Thanks for your time. |
Just fyi, for Groupdate 6, I've updated the gem to work when time zones are inconsistent, so this error won't appear anymore. |
Your efforts in maintaining this amazing gem is much appreciated! |
Hi,
i'm confused. Since Rails 5.2 I cannot use Groupdate in rails console.
Groupdate::Error (Database and Ruby have inconsistent time zone info. Database returned 2016-09-01 02:00:00 +0200)
The default Timezone is
:utc
config.active_record.default_timezone = :utc
How can I fix this?
The text was updated successfully, but these errors were encountered: