Skip to content
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

Date querying test failures due to timezones #43

Open
brocktimus opened this issue Mar 16, 2013 · 2 comments
Open

Date querying test failures due to timezones #43

brocktimus opened this issue Mar 16, 2013 · 2 comments

Comments

@brocktimus
Copy link
Collaborator

I was looking at a few things today and was getting test failures for seemingly random reasons. I figured out later that I think its probably due to TZ conversions.

I was testing stuff before 8AM and I'm living in +8. So I'm guessing was 2013-03-16 but the DB entries were 2013-03-15 (because they're saved as UTC).

https://github.com/wvanbergen/scoped_search/blob/master/spec/integration/ordinal_querying_spec.rb#L191

https://github.com/wvanbergen/scoped_search/blob/master/spec/integration/ordinal_querying_spec.rb#L195

Does this reasoning sound about right? I've got a few ideas to try, like calling .to_utc or something on the date as well (if that's a thing!?).

@wvanbergen
Copy link
Owner

You can call .utc on a DateTime or Timestamp.
I am not sure if this is part o Ruby or ActiveSupport though, and if it is available in all versions.

The tricky part is:

  • Can we always assume times in the DB are in UTC?
  • Can we always assume the time the user specifies in the query is in the same timezone as the server's timezone?

@wvanbergen
Copy link
Owner

Having said that, we should make sure our testsuite doesn't run into these timezone issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants