admin管理员组文章数量:1334176
I have a table called visitDetails, which I'm querying as follows,
realm
.objects("visitDetails")
.filtered("visitDate='"+new Date(response.date)+"' AND chemistId='"+response.chemist_id+"'");
I have saved the visitDate as date objects before, so I'm also querying by date objects. I'm however, getting as error saying,
Error: You must pass in a date argument to pare
But I'm already passing in a date argument...
new Date( response.date )
, where response.date is in milliseconds.
I have a table called visitDetails, which I'm querying as follows,
realm
.objects("visitDetails")
.filtered("visitDate='"+new Date(response.date)+"' AND chemistId='"+response.chemist_id+"'");
I have saved the visitDate as date objects before, so I'm also querying by date objects. I'm however, getting as error saying,
Error: You must pass in a date argument to pare
But I'm already passing in a date argument...
new Date( response.date )
, where response.date is in milliseconds.
Share Improve this question asked Aug 3, 2017 at 6:17 Abhishek AcharyaAbhishek Acharya 3294 silver badges13 bronze badges 1- Abhishek what can you tell me how did you save the date in the realm. The property is date type right? and in which format did you save? – Omer Commented Dec 17, 2017 at 12:27
2 Answers
Reset to default 6Right now you are casting the Date
object to a string by concatenate it with a string.
You should do something like this
realm.objects('visitDetails').filtered(
"visitDate = $0 AND chemistId = $1",
new Date(response.date),
response.chemist_id
);
Quick solution here. You should pass date as parameter.
.filtered("visitDate = $0 AND chemistId = $1", new Date(response.date), response.chemist_id);
本文标签: javascriptHow to query by date in react realmStack Overflow
版权声明:本文标题:javascript - How to query by date in react realm? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742359377a2460060.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论