You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Neo4j Version: 4.0 Enterprise Docker Neo4j Mode: Single instance Driver version: JS driver ^4.0.2 Operating System: Windows 10
Steps to reproduce
Start Neo4j
Run a query with the driver (return datetime())
Expected behavior
I expect the datetime() that is being returned to be in a string format.
Actual behavior
It parses the value into a custom object with properties like day, month, year, etc.
I can see how this can be useful but the string value is just as valuable. If I want to send the date property to the frontend app I would always have to convert it otherwise the toString function will be lost on the object.
It would be nice to have an option on a per query basis or even better a global options setting to disable parsing the datetime and just return the string value.
I'm facing a similar issue, is it due to the fact that neo4j-driver serializes as a JSON object (with fields year, month, day, etc.) instead of an ISO date string ?
Most libs that deal with dates try to stick to native JS Dates, is there a motivation for not doing this here ?
Neo4j has a well define type system, so different temporal types has their own representation inside the database. These types are also mapped in specialised structures in the client/server communication and in the code itself. This is the reason we have all this temporal types in the javascript driver.
We could provide toJSON method to these classes, this could avoid the extra-steps when you just want to serialize the record to json.
We actually could not provide the .toJSON method since it will be a breaking change since it is possible to have code depending on the current behaviour.
Neo4j Version: 4.0 Enterprise Docker
Neo4j Mode: Single instance
Driver version: JS driver ^4.0.2
Operating System: Windows 10
Steps to reproduce
Expected behavior
I expect the datetime() that is being returned to be in a string format.
Actual behavior
It parses the value into a custom object with properties like day, month, year, etc.
I can see how this can be useful but the string value is just as valuable. If I want to send the date property to the frontend app I would always have to convert it otherwise the toString function will be lost on the object.
It would be nice to have an option on a per query basis or even better a global options setting to disable parsing the datetime and just return the string value.
This is my horrible temporary workaround.
PS: this does not take into account nested objects or arrays.
The text was updated successfully, but these errors were encountered: