-
Notifications
You must be signed in to change notification settings - Fork 120
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
Support DateTime query conditions (or at least document current approach) #287
Comments
Currently for date fields, you need to use the timestamp, i.e. the same thing is stored internally in the database (it's a millisecond timestamp for date fields and nanosecond timestamp for Assuming an @Entity()
class Order {
final int id;
final DateTime date;
}
...
final query = box.query(
Order_.date.between(DateTime(2020).millisecondsSinceEpoch, DateTime(2021).millisecondsSinceEpoch - 1)
).build(); It would be nice for all the query conditions to support DateTime fields directly so leaving this issue open as a feature request. |
Thanks for the answer, can we put it in dart documentation (example page) and object box documentation, because currently it is not mentioned there and I think anyone checking the documentation will infer limited or no query operations for date time. |
Hi, can I work on this? |
any update? |
@OHeroJ We share updates if there are some, no need to ask, thanks! Edit: The current approach is documented at https://docs.objectbox.io/queries#common-conditions Edit: if you are interested in something, it helps us more if you thumbs up the first comment! |
I would like to work on this |
New conditions were added and will be available with the next release. |
ObjectBox version: [e.g. 0.14.0]
1.1.1
Flutter/Dart SDK: [e.g. 2.0.0, or the output of
dart --version
orflutter --version
]Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision f4abaa0735 (3 weeks ago) • 2021-07-01 12:46:11 -0700 Engine • revision 241c87ad80 Tools • Dart 2.13.4
Null-safety enabled: [yes | no]
yes
Reproducibility: [e.g. occurred once only | occasionally without visible pattern | always]
Create any Entity with DateTime as one of the variable
Try to build query condition in the DateTime Variable. The property comes as an Integer property and not as a DateTime property. How to use query conditions like before or after, etc.
The text was updated successfully, but these errors were encountered: