-
Notifications
You must be signed in to change notification settings - Fork 156
Description
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, but P6.5M4D is not.
When creating a new Duration with 6.5 months however it is stored in the database as P6M since it calls int(months) in packDuration
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:
monthsifdayssecondsandnanosecondsare zero.daysifsecondsandnanosecondsare zero.
Asserting this would make sure the resulting duration would be valid.
Steps to reproduce
- Start local Neo4j instance
- Clone repository
git clone [email protected]:dmoree/neo4j-javascript-driver-issue-duration.git
- Run (creates duration and uses it when adding node in database)
npm start
- Check output and confirm in database that duration is incorrect.
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