-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Date precisision not precise enough (dropps all milliseconds) #833
Comments
Hi @falkorichter The reason is that we want Realms to function cross-platform eg. NSDate uses floating points internally. This is why we currently only support second-precision (it is the same on iOS), but we definitely want to fix it going forward, it is just not a trivial thing to do. For now, a workaround would be to store your dates as long and convert them back to Date when needed. |
@cmelchior why not drop the Date support completely on Android as it is crippled? Bring it back, when it is working. |
Please fix this. Really annoying to write all the code to use Dates only to discover that precision is not enough and rewrite everything to use long. |
👍 |
1 similar comment
👍 |
Java Dates have a millisecond presicsion. Realm queries on dates should respect this precision.
See the example project:
https://github.com/falkorichter/realm-date-fail
The test class in question:
https://github.com/falkorichter/realm-date-fail/blob/master/app/src/androidTest/java/com/sensorberg/android/realmdatecomparison/ApplicationTest.java
The tests shows that with 999 milliseconds difference, realm fails to query correctly.
See the status of this test at: https://travis-ci.org/falkorichter/realm-date-fail.svg?branch=master
The text was updated successfully, but these errors were encountered: