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

Having option to neo4i timezone config #1127

Open
gadikotamohan opened this issue Feb 8, 2016 · 5 comments
Open

Having option to neo4i timezone config #1127

gadikotamohan opened this issue Feb 8, 2016 · 5 comments

Comments

@gadikotamohan
Copy link

https://github.com/neo4jrb/neo4j/blob/12428d057150e35e65983a999593bd0de6e42666/lib/neo4j/shared/type_converters.rb#l166-#l172

I would suggest to have a neo4j's timezone to honor application.rb's default timezone or have seperate config..
Eg: I have timezone's config to 'Asia/Kolkata' and I expected the timestamp saved in to db is of 'Asia/Kolkata' but internally the datetime/time/date object is converted into utc and its timestamp is saved.

This isn't a issue, a feature request for neo4j.

@cheerfulstoic
Copy link
Contributor

Currently the Neo4j DB doesn't have native support for times, dates, or timezones. I thought I had heard that they were hoping to do this in 3.0, but I'm not sure.

So for now we should discuss this in terms of what Neo4j.rb can do with properties as they exist in Neo4j. In SQL (at least in some SQL databases) there is a concept of columns being either "datetime with timezone" or "datetime without timezone". With a timezone means that it stores both the stamp and the timezone that it is for. Without a timezone means that it stores everything in UTC or perhaps as a UNIX timestamp.

In ActiveRecord I believe that date/time fields are always stored as datetime without timezone. It will respect your current timezone setting (set in application.rb or wherever) going in and coming out and it will do the appropriate conversions.

All of that was said to make sure that we're on the same page. AFAIK Neo4j.rb conforms to that, but are you finding behavior that doesn't work like that? Or is there something else that you would rather that it do? If so could you provide code examples?

Thanks for the feedback!

@gadikotamohan
Copy link
Author

@cheerfulstoic Neo4j rb doesn't conforms to application.rb settings.
ie;
User.last.created_at # Would return UTC datetime object, but in application timezone was set to Asia/Kolkata
this happened from 6.1.1 to 6.1.7. I haven't upgraded neo4j to latest version yet.

@gadikotamohan gadikotamohan reopened this Apr 26, 2016
@cheerfulstoic
Copy link
Contributor

I'm not sure I understand the issue. Could you fill out your example with a bit more info, especially about what is the correct expected behavior and what is the wrong behavior?

Also, it would be really useful if you could pin down the first version between 6.1.1 and 6.1.7 caused the issue.

Thanks!

@benjaminbradley
Copy link

benjaminbradley commented Sep 1, 2016

I'm seeing this with v7.0.5
According to documentation, ActiveRecord will convert DateTime fields to the local time zone (as defined in application.rb) when the data is loaded from the DB, but the Neo4j gem does not do any TZ conversion when data is loaded.

irb(main):002:0> Time.zone.name
=> "Central Time (US & Canada)"
irb(main):003:0> EventLog.first.created_at
 CYPHER 24ms MATCH (n:`EventLog`) RETURN n ORDER BY n.uuid LIMIT {limit_1} | {:limit_1=>1}
=> Thu, 01 Sep 2016 19:47:49 +0000

Currently I have to convert to the timezone manually:

irb(main):005:0> EventLog.first.created_at.in_time_zone       
 CYPHER 4ms MATCH (n:`EventLog`) RETURN n ORDER BY n.uuid LIMIT {limit_1} | {:limit_1=>1}
=> Thu, 01 Sep 2016 14:47:49 CDT -05:00

@cheerfulstoic
Copy link
Contributor

@gadikotamohan I would like to leave this open so that we can look into it / prioritize it later. If you don't want to receive notifications I believe that you can unsubscribe in the sidebar on the right.

@cheerfulstoic cheerfulstoic reopened this Dec 20, 2016
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

3 participants