-
Notifications
You must be signed in to change notification settings - Fork 149
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
[Feature Request]
: Allow float values in Durations
#768
Comments
Hi @dmoree, the duration on the Neo4j drivers (not only the javascript driver) treats How did you store/retrieve |
I see. I was not using any driver to store/retrieve Using the Neo4j browser in the second way one could even specify all floats positive or negative such as Is there something beyond definition in the protocol that requires the values to be |
Browser uses this driver. So I will double check internally how browser is handling this data type. I am not sure if there is something beyond the protocol definition which requires the values to be However, I'd like to know the use case of using |
I appreciate you looking into this. I thought the browser uses this driver, but wasn't sure. The particular use case is I am trying to implement a Thanks again for your time. |
Description
When inserting a node with a duration property into the database, float values are truncating leaving only integer values. Both the ISO 8601 standard and Neo4j allow for decimal fractions on values so long as the decimal fraction is on the smallest unit. For example
P6.5M
is valid, butP6.5M4D
is not.When creating a new
Duration
with6.5
months however it is stored in the database asP6M
since it callsint(months)
inpackDuration
The driver should allow for float values on month and day if resulting in valid duration. This ideally would have an
assertValidDuration
that would make sure float values are not passed improperly. Float values should only be accepted on:months
ifdays
seconds
andnanoseconds
are zero.days
ifseconds
andnanoseconds
are zero.Asserting this would make sure the resulting duration would be valid.
Steps to reproduce
Expected behavior
The duration should be stored as
P6.5M0DT0S
Actual behavior
The duration is stored as
P6M0DT0S
System
Neo4j Version: 4.3.3 Enterprise
Neo4j Mode: Single instance
Driver Version: 4.3.3 (javascript)
Operating System: macOS 11.5
Node Version: 14.16.0
The text was updated successfully, but these errors were encountered: