Skip to content

Add property-based testing to temporal-types conversion (#997) #1001

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

Merged
merged 3 commits into from
Sep 21, 2022

Conversation

bigmontz
Copy link
Contributor

Add this type of testing to .toString() ('should be serialize string which can be loaded by new Date') helps to cover corner cases and solve special cases such:

  • Negative date time not being serialised correctly in the iso standard. Years should always have 6 digits and the signal in front for working correctly with negative years and high numbers. This also avoids the year 2000 problem. See, https://en.wikipedia.org/wiki/ISO_8601
  • Date.fromStandardDate factory was not taking in consideration the seconds contribution in the timezone offset. This is not a quite common scenario, but there are dates with timezone offset of for example 50 minutes and 20 seconds.
  • Fix Date.toString for dates with offsets of seconds. Javascript Date constructor doesn't create dates from iso strings with seconds in the offset. For instance, new Date("2010-01-12T14:44:53+00:00:10"). So, this tests should be skipped.

Add this type of testing to `.toString()` ('should be serialize string which can be loaded by new Date') helps to cover corner cases and solve special cases such:

* Negative date time not being serialised correctly in the iso standard. Years should always have 6 digits and the signal in front for working correctly with negative years and high numbers. This also avoids the year 2000 problem. See, https://en.wikipedia.org/wiki/ISO_8601
* `Date.fromStandardDate` factory was not taking in consideration the `seconds` contribution in the timezone offset. This is not a quite common scenario, but there are dates with timezone offset of for example `50 minutes` and `20 seconds`.
* Fix `Date.toString` for dates with offsets of seconds. Javascript Date constructor doesn't create dates from iso strings with seconds in the offset. For instance, `new Date("2010-01-12T14:44:53+00:00:10")`. So, this tests should be skipped.
@bigmontz
Copy link
Contributor Author

Adapted cherry pick from: #997

@robsdedude robsdedude self-requested a review September 21, 2022 09:02
Copy link
Member

@robsdedude robsdedude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is a breaking API change, it's also a fix. Not sure about the severity and if it's worth potentially breaking users.

Lastly, I checked the API documentation and that function isn't documented at all. So one could always argues it's fair game to break undocumented API, especially if it fixes things.

@bigmontz bigmontz merged commit fdd043c into neo4j:4.4 Sep 21, 2022
@bigmontz bigmontz deleted the 4.4-fix-datetime-toStandardDate branch September 21, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants